home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / syntax.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  136.0 KB  |  3,471 lines

  1. *syntax.txt*    For Vim version 6.0.  Last change: 2001 Sep 19
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Syntax highlighting        *syntax* *syntax-highlighting* *coloring*
  8.  
  9. Syntax highlighting enables Vim to show parts of the text in another font or
  10. color.  Those parts can be specific keywords or text matching a pattern.  Vim
  11. doesn't parse the whole file (to keep it fast), so the highlighting has its
  12. limitations.  Lexical highlighting might be a better name, but since everybody
  13. calls it syntax highlighting we'll stick with that.
  14.  
  15. Vim supports syntax highlighting on all terminals.  But since most ordinary
  16. terminals have very limited highlighting possibilities, it works best in the
  17. GUI version, gvim.
  18.  
  19. In the User Manual:
  20. |usr_06.txt| introduces syntax highlighting.
  21. |usr_44.txt| introduces writing a syntax file.
  22.  
  23. 1.  Quick start            |:syn-qstart|
  24. 2.  Syntax files        |:syn-files|
  25. 3.  Syntax loading procedure    |syntax-loading|
  26. 4.  Syntax file remarks        |:syn-file-remarks|
  27. 5.  Defining a syntax        |:syn-define|
  28. 6.  :syntax arguments        |:syn-arguments|
  29. 7.  Syntax patterns        |:syn-pattern|
  30. 8.  Syntax clusters        |:syn-cluster|
  31. 9.  Including syntax files    |:syn-include|
  32. 10. Synchronizing        |:syn-sync|
  33. 11. Listing syntax items    |:syntax|
  34. 12. Highlight command        |:highlight|
  35. 13. Linking groups        |:highlight-link|
  36. 14. Cleaning up            |:syn-clear|
  37. 15. Highlighting tags        |tag-highlight|
  38. 16. Color xterms        |xterm-color|
  39.  
  40. {Vi does not have any of these commands}
  41.  
  42. Syntax highlighting is not available when the |+syntax| feature has been
  43. disabled at compile time.
  44.  
  45. ==============================================================================
  46. 1. Quick start                        *:syn-qstart*
  47.  
  48.                         *:syn-enable* *:syntax-enable*
  49. This command switches on syntax highlighting: >
  50.  
  51.     :syntax enable
  52.  
  53. What this command actually does is to execute the command >
  54.     :source $VIMRUNTIME/syntax/syntax.vim
  55.  
  56. If the VIM environment variable is not set, Vim will try to find
  57. the path in another way (see |$VIMRUNTIME|).  Usually this works just
  58. fine.  If it doesn't, try setting the VIM environment variable to the
  59. directory where the Vim stuff is located.  For example, if your syntax files
  60. are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to
  61. "/usr/vim/vim50".  You must do this in the shell, before starting Vim.
  62.  
  63.                             *:syn-on* *:syntax-on*
  64. The ":syntax enable" command will keep your current color settings.  This
  65. allows using ":highlight" commands to set your preferred colors before or
  66. after using this command.  If you want Vim to overrule your settings with the
  67. defaults, use: >
  68.     :syntax on
  69. <
  70.                     *:hi-normal* *:highlight-normal*
  71. If you are running in the GUI, you can get white text on a black background
  72. with: >
  73.     :highlight Normal guibg=Black guifg=White
  74. For a color terminal see |:hi-normal-cterm|.
  75. For setting up your own colors syntax highlighting see |syncolor|.
  76.  
  77. NOTE: The syntax files on MS-DOS and Windows have lines that end in <CR><NL>.
  78. The files for Unix end in <NL>.  This means you should use the right type of
  79. file for your system.  Although on MS-DOS and Windows the right format is
  80. automatically selected if the 'fileformats' option is not empty.
  81.  
  82. NOTE: When using reverse video ("gvim -fg white -bg black"), the default value
  83. of 'background' will not be set until the GUI window is opened, which is after
  84. reading the .gvimrc.  This will cause the wrong default highlighting to be
  85. used.  To set the default value of 'background' before switching on
  86. highlighting, include the ":gui" command in the .gvimrc: >
  87.  
  88.    :gui        " open window and set default for 'background'
  89.    :syntax on    " start highlighting, use 'background' to set colors
  90.  
  91. NOTE: Using ":gui" in the .gvimrc means that "gvim -f" won't start in the
  92. foreground!  Use ":gui -f" then.
  93.  
  94.  
  95. You can toggle the syntax on/off with this command >
  96.    :if exists("syntax_on") | syntax off | else | syntax enable | endif
  97.  
  98. To put this into a mapping, you can use: >
  99.    :map <F7> :if exists("syntax_on") <Bar>
  100.     \   syntax off <Bar>
  101.     \ else <Bar>
  102.     \   syntax enable <Bar>
  103.     \ endif <CR>
  104. [using the |<>| notation, type this literally]
  105.  
  106. Details
  107. The ":syntax" commands are implemented by sourcing a file.  To see exactly how
  108. this works, look in the file:
  109.     command        file ~
  110.     :syntax enable    $VIMRUNTIME/syntax/syntax.vim
  111.     :syntax on        $VIMRUNTIME/syntax/syntax.vim
  112.     :syntax manual    $VIMRUNTIME/syntax/manual.vim
  113.     :syntax off        $VIMRUNTIME/syntax/nosyntax.vim
  114. Also see |syntax-loading|.
  115.  
  116. ==============================================================================
  117. 2. Syntax files                        *:syn-files*
  118.  
  119. The syntax and highlighting commands for one language are normally stored in
  120. a syntax file.  The name convention is: "{name}.vim".  Where {name} is the
  121. name of the language, or an abbreviation (to fit the name in 8.3 characters,
  122. a requirement in case the file is used on a DOS filesystem).
  123. Examples:
  124.     c.vim        perl.vim    java.vim    html.vim
  125.     cpp.vim        sh.vim        csh.vim
  126.  
  127. The syntax file can contain any Ex commands, just like a vimrc file.  But
  128. the idea is that only commands for a specific language are included.  When a
  129. language is a superset of another language, it may include the other one,
  130. for example, the cpp.vim file could include the c.vim file: >
  131.    :so $VIMRUNTIME/syntax/c.vim
  132.  
  133. The .vim files are normally loaded with an autocommand.  For example: >
  134.    :au Syntax c        source $VIMRUNTIME/syntax/c.vim
  135.    :au Syntax cpp   source $VIMRUNTIME/syntax/cpp.vim
  136. These commands are normally in the file $VIMRUNTIME/syntax/synload.vim.
  137.  
  138.  
  139. MAKING YOUR OWN SYNTAX FILES                *mysyntaxfile*
  140.  
  141. When you create your own syntax files, and you want to have Vim use these
  142. automatically with ":syntax enable", do this:
  143.  
  144. 1. Create your user runtime directory.  You would normally use the first item
  145.    of the 'runtimepath' option.  Example for Unix: >
  146.     mkdir ~/.vim
  147.  
  148. 2. Create a directory in there called "syntax".  For Unix: >
  149.     mkdir ~/.vim/syntax
  150.  
  151. 3. Write the Vim syntax file.  Or download one from the internet.  Then write
  152.    it in your syntax directory.  For example, for the "mine" syntax: >
  153.     :w ~/.vim/syntax/mine.vim
  154.  
  155. Now you can start using your syntax file manually: >
  156.     :set syntax=mine
  157. You don't have to exit Vim to use this.
  158.  
  159. If you also want Vim to detect the type of file, see |new-filetype|.
  160.  
  161. If you are setting up a system with many users and you don't want each user
  162. to add the same syntax file, you can use another directory from 'runtimepath'.
  163.  
  164.  
  165. ADDING TO AN EXISTING SYNTAX FILE        *mysyntaxfile-add*
  166.  
  167. If you are mostly satisfied with an existing syntax file, but would like to
  168. add a few items or change the highlighting, follow these steps:
  169.  
  170. 1. Create your user directory from 'runtimepath', see above.
  171.  
  172. 2. Create a directory in there called "after/syntax".  For Unix: >
  173.     mkdir ~/.vim/after
  174.     mkdir ~/.vim/after/syntax
  175.  
  176. 3. Write a Vim script that contains the commands you want to use.  For
  177.    example, to change the colors for the C syntax: >
  178.     highlight cComment ctermfg=Green guifg=Green
  179.  
  180. 4. Write that file in the "after/syntax" directory.  Use the name of the
  181.    syntax, with ".vim" added.  For our C syntax: >
  182.     :w ~/.vim/after/syntax/c.vim
  183.  
  184. That's it.  The next time you edit a C file the Comment color will be
  185. different.  You don't even have to restart Vim.
  186.  
  187.  
  188. REPLACING AN EXISTING SYNTAX FILE            *mysyntaxfile-replace*
  189.  
  190. If you don't like a distributed syntax file, or you have downloaded a new
  191. version, follow the same steps as for |mysyntaxfile| above.  Just make sure
  192. that you write the syntax file in a directory that is early in 'runtimepath'.
  193. Vim will only load the first syntax file found.
  194.  
  195.  
  196. NAMING CONVENTIONS
  197.                             *group-name*
  198. To be able to allow each user to pick his favorite set of colors, there must
  199. be preferred names for highlight groups that are common for many languages.
  200. These are the suggested group names:
  201.  
  202.     *Comment    any comment
  203.  
  204.     *Constant    any constant
  205.      String        a string constant: "this is a string"
  206.      Character    a character constant: 'c', '\n'
  207.      Number        a number constant: 234, 0xff
  208.      Boolean    a boolean constant: TRUE, false
  209.      Float        a floating point constant: 2.3e10
  210.  
  211.     *Identifier    any variable name
  212.      Function    function name (also: methods for classes)
  213.  
  214.     *Statement    any statement
  215.      Conditional    if, then, else, endif, switch, etc.
  216.      Repeat        for, do, while, etc.
  217.      Label        case, default, etc.
  218.      Operator    "sizeof", "+", "*", etc.
  219.      Keyword    any other keyword
  220.      Exception    try, catch, throw
  221.  
  222.     *PreProc    generic Preprocessor
  223.      Include    preprocessor #include
  224.      Define        preprocessor #define
  225.      Macro        same as Define
  226.      PreCondit    preprocessor #if, #else, #endif, etc.
  227.  
  228.     *Type        int, long, char, etc.
  229.      StorageClass    static, register, volatile, etc.
  230.      Structure    struct, union, enum, etc.
  231.      Typedef    A typedef
  232.  
  233.     *Special    any special symbol
  234.      SpecialChar    special character in a constant
  235.      Tag        you can use CTRL-] on this
  236.      Delimiter    character that needs attention
  237.      SpecialComment    special things inside a comment
  238.      Debug        debugging statements
  239.  
  240.     *Underlined    text that stands out, HTML links
  241.  
  242.     *Ignore        left blank, hidden
  243.  
  244.     *Error        any erroneous construct
  245.  
  246.     *Todo        anything that needs extra attention; mostly the
  247.             keywords TODO FIXME and XXX
  248.  
  249. The names marked with * are the preferred groups; the others are minor groups.
  250. For the preferred groups, the "syntax.vim" file contains default highlighting.
  251. The minor groups are linked to the preferred groups, so they get the same
  252. highlighting.  You can override these defaults by using ":highlight" commands
  253. after sourcing the "syntax.vim" file.
  254.  
  255. Note that highlight group names are not case sensitive.  "String" and "string"
  256. can be used for the same group.
  257.  
  258. The following names are reserved and cannot be used as a group name:
  259.     NONE   ALL   ALLBUT   contains   contained
  260.  
  261. ==============================================================================
  262. 3. Syntax loading procedure                *syntax-loading*
  263.  
  264. This explains the details that happen when the command ":syntax enable" is
  265. issued.  When Vim initializes itself, it finds out where the runtime files are
  266. located.  This is used here as the variable |$VIMRUNTIME|.
  267.  
  268. ":syntax enable" and ":syntax on" do the following:
  269.  
  270.     Source $VIMRUNTIME/syntax/syntax.vim
  271.     |
  272.     +-    Clear out any old syntax by sourcing $VIMRUNTIME/syntax/nosyntax.vim
  273.     |
  274.     +-    Source $VIMRUNTIME/syntax/synload.vim from 'runtimepath'
  275.     |    |
  276.     |    +-  Setup the colors for syntax highlighting.  If a color scheme is
  277.     |    |   defined it is loaded again with ":colors {name}".  Otherwise
  278.     |    |   ":runtime! syntax/syncolor.vim" is used.  ":syntax on" overrules
  279.     |    |   existing colors, ":syntax enable" only sets groups that weren't
  280.     |    |   set yet.
  281.     |    |
  282.     |    +-  Set up syntax autocmds to load the appropriate syntax file when
  283.     |    |   the 'syntax' option is set. *synload-1*
  284.     |    |
  285.     |    +-  Source the user's optional file, from the |mysyntaxfile| variable.
  286.     |        This is for backwards compatibility with Vim 5.x only. *synload-2*
  287.     |
  288.     +-    Do ":filetype on", which does ":runtime! filetype.vim".  It loads any
  289.     |    filetype.vim files found.  It should always Source
  290.     |    $VIMRUNTIME/filetype.vim, which does the following.
  291.     |    |
  292.     |    +-  Install autocmds based on suffix to set the 'filetype' option
  293.     |    |   This is where the connection between file name and file type is
  294.     |    |   made for known file types. *synload-3*
  295.     |    |
  296.     |    +-  Source the user's optional file, from the *myfiletypefile*
  297.     |    |   variable.  This is for backwards compatibility with Vim 5.x only.
  298.     |    |   *synload-4*
  299.     |    |
  300.     |    +-  Install one autocommand which sources scripts.vim when no file
  301.     |    |   type was detected yet. *synload-5*
  302.     |    |
  303.     |    +-  Source $VIMRUNTIME/menu.vim, to setup the Syntax menu. |menu.vim|
  304.     |
  305.     +-    Install a FileType autocommand to set the 'syntax' option when a file
  306.     |    type has been detected. *synload-6*
  307.     |
  308.     +-    Execute syntax autocommands to start syntax highlighting for each
  309.     already loaded buffer.
  310.  
  311.  
  312. Upon loading a file, Vim finds the relevant syntax file as follows:
  313.  
  314.     Loading the file triggers the BufReadPost autocommands.
  315.     |
  316.     +-    If there is a match with one of the autocommands from |synload-3|
  317.     |    (known file types) or |synload-4| (user's file types), the 'filetype'
  318.     |    option is set to the file type.
  319.     |
  320.     +-    The autocommand at |synload-5| is triggered.  If the file type was not
  321.     |    found yet, then scripts.vim is searched for in 'runtimepath'.  This
  322.     |    should always load $VIMRUNTIME/scripts.vim, which does the following.
  323.     |    |
  324.     |    +-  Source the user's optional file, from the *myscriptsfile*
  325.     |    |   variable.  This is for backwards compbatibility with Vim 5.x only.
  326.     |    |
  327.     |    +-  If the file type is still unknown, check the contents of the file,
  328.     |        again with checks like "getline(1) =~ pattern" as to whether the
  329.     |        file type can be recognized, and set 'filetype'.
  330.     |
  331.     +-    When the file type was determined and 'filetype' was set, this
  332.     |    triggers the FileType autocommand |synload-6| above.  It sets
  333.     |    'syntax' to the determined file type.
  334.     |
  335.     +-    When the 'syntax' option was set above, this triggers an autocommand
  336.     |    from |synload-1| (and |synload-2|).  This find the main syntax file in
  337.     |    'runtimepath', with this command:
  338.     |        runtime! syntax/<name>.vim
  339.     |
  340.     +-    Any other user installed FileType or Syntax autocommands are
  341.     triggered.  This can be used to change the highlighting for a specific
  342.     syntax.
  343.  
  344. ==============================================================================
  345. 4. Syntax file remarks                    *:syn-file-remarks*
  346.  
  347.                         *b:current_syntax-variable*
  348. Vim stores the name of the syntax that has been loaded in the
  349. "b:current_syntax" variable.  You can use this if you want to load other
  350. settings, depending on which syntax is active.  Example: >
  351.    :au BufReadPost * if b:current_syntax == "csh"
  352.    :au BufReadPost *   do-some-things
  353.    :au BufReadPost * endif
  354.  
  355.  
  356. 2HTML                        *2html.vim* *convert-to-HTML*
  357.  
  358. This is not a syntax file itself, but a script that converts the current
  359. window into HTML.  Vim opens a new window in which it builds the HTML file.
  360.  
  361. You are not supposed to set the 'filetype' or 'syntax' option to "2html"!
  362. Source the script to convert the current file: >
  363.  
  364.     :runtime! syntax/2html.vim
  365. <
  366.     Warning: This is slow!
  367.  
  368. After you save the resulting file, you can view it with any HTML viewer, such
  369. as Netscape.  The colors should be exactly the same as you see them in Vim.
  370.  
  371. The lines are numbered according to 'number' option and the Number
  372. highlighting.  You can force lines to be numbered in the HTML output by
  373. setting "html_number_lines" to nonzero value: >
  374.    :let html_number_lines = 1
  375. Force to omit the line numbers by using a zero value: >
  376.    :let html_number_lines = 0
  377. Go back to the default to use 'number' by deleting the variable: >
  378.    :unlet html_number_lines
  379.  
  380. By default, HTML optimized for old browsers is generated.  If you prefer using
  381. cascading style sheets (CSS1) for the attributes (resulting in considerably
  382. shorter and valid HTML 4 file), use: >
  383.    :let html_use_css = 1
  384.  
  385. Remarks:
  386. - This only works in a version with GUI support.  If the GUI is not actually
  387.   running (possible for X11) it still works, but not very well (the colors
  388.   may be wrong).
  389. - Older browsers will not show the background colors.
  390. - From most browsers you can also print the file (in color)!
  391.  
  392. Here is an example how to run the script over all .c and .h files from a
  393. Unix shell: >
  394.    for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done
  395. <
  396.  
  397. ABEL                            *abel.vim* *abel-syntax*
  398.  
  399. ABEL highlighting provides some user-defined options.  To enable them, assign
  400. any value to the respective variable.  Example: >
  401.     :let abel_obsolete_ok=1
  402. To disable them use ":unlet".  Example: >
  403.     :unlet abel_obsolete_ok
  404.  
  405. Variable            Highlight ~
  406. abel_obsolete_ok        obsolete keywords are statements, not errors
  407. abel_cpp_comments_illegal    do not interpret '//' as inline comment leader
  408.  
  409.  
  410.         *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k*
  411. ASSEMBLY    *asm-syntax* *asmh8300-syntax* *nasm-syntax* *masm-syntax*
  412.         *asm68k-syntax*
  413.  
  414. Files matching "*.i" could be Progress or Assembly.  If the automatic detection
  415. doesn't work for you, or you don't edit Progress at all, use this in your
  416. startup vimrc: >
  417.    :let filetype_i = "asm"
  418. Replace "asm" with the type of assembly you use.
  419.  
  420. There are many types of assembly languages that all use the same file name
  421. extensions.  Therefore you will have to select the type yourself, or add a
  422. line in the assembly file that Vim will recognize.  Currently these syntax
  423. files are included:
  424.     asm        GNU assembly (the default)
  425.     asm68k        Motorola 680x0 assembly
  426.     asmh8300    Hitachi H-8300 version of GNU assembly
  427.     ia64        Intel Itanium 64
  428.     masm        Microsoft assembly (probably works for any 80x86)
  429.     nasm        Netwide assembly
  430.     tasm        Turbo Assembly (with opcodes 80x86 up to Pentium, and
  431.             MMX)
  432.     pic        PIC assembly (currently for PIC16F84)
  433.  
  434. The most flexible is to add a line in your assembly file containing: >
  435.     :asmsyntax=nasm
  436. Replace "nasm" with the name of the real assembly syntax.  This line must be
  437. one of the first five lines in the file.
  438.  
  439. The syntax type can always be overruled for a specific buffer by setting the
  440. b:asmsyntax variable: >
  441.     :let b:asmsyntax=nasm
  442.  
  443. If b:asmsyntax is not set, either automatically or by hand, then the value of
  444. the global variable asmsyntax is used.  This can be seen as a default assembly
  445. language: >
  446.     :let asmsyntax=nasm
  447.  
  448. As a last resort, if nothing is defined, the "asm" syntax is used.
  449.  
  450.  
  451. Netwide assembler (nasm.vim) optional highlighting ~
  452.  
  453. To enable a feature: >
  454.     :let   {variable}=1|set syntax=nasm
  455. To disable a feature: >
  456.     :unlet {variable}  |set syntax=nasm
  457.  
  458. Variable        Highlight ~
  459. nasm_loose_syntax    unofficial parser allowed syntax not as Error
  460.               (parser dependend; not recommended)
  461. nasm_ctx_outside_macro    contexts outside macro not as Error
  462. nasm_no_warn        potentially risky syntax not as ToDo
  463.  
  464.  
  465. ASPPERL and ASPVBS            *aspperl-syntax* *aspvbs-syntax*
  466.  
  467. *.asp and *.asa files could be either Perl or Visual Basic script.  Since it's
  468. hard to detect this you can set two global variables to tell Vim what you are
  469. using.  For Perl script use: >
  470.     :let g:filetype_asa = "aspperl"
  471.     :let g:filetype_asp = "aspperl"
  472. For Visual Basic use: >
  473.     :let g:filetype_asa = "aspvbs"
  474.     :let g:filetype_asp = "aspvbs"
  475.  
  476.  
  477. BASIC                *basic.vim* *vb.vim* *basic-syntax* *vb-syntax*
  478.  
  479. Both Visual Basic and "normal" basic use the extension ".bas".  To detect
  480. which one should be used, Vim checks for the string "VB_Name" in the first
  481. five lines of the file.  If it is not found, filetype will be "basic",
  482. otherwise "vb".  Files with the ".frm" extension will always be seen as Visual
  483. Basic.
  484.  
  485.  
  486. C                            *c.vim* *c-syntax*
  487.  
  488. A few things in C highlighting are optional.  To enable them assign any value
  489. to the respective variable.  Example: >
  490.     :let c_comment_strings=1
  491. To disable them use ":unlet".  Example: >
  492.     :unlet c_comment_strings
  493.  
  494. Variable        Highlight ~
  495. c_gnu            GNU gcc specific items
  496. c_comment_strings    strings and numbers inside a comment
  497. c_space_errors        trailing white space and spaces before a <Tab>
  498. c_no_trail_space_error     ... but no trailing spaces
  499. c_no_tab_space_error     ... but no spaces before a <Tab>
  500. c_no_ansi        don't do standard ANSI types and constants
  501. c_ansi_typedefs         ... but do standard ANSI types
  502. c_ansi_constants     ... but do standard ANSI constants
  503. c_no_utf        don't highlight \u and \U in strings
  504. c_syntax_for_h        use C syntax for *.h files, instead of C++
  505. c_no_if0        don't highlight "#if 0" blocks as comments
  506. c_no_cformat        don't highlight %-formats in strings
  507. c_no_c99        con't highlight C99 standard items
  508.  
  509. If you notice highlighting errors while scrolling backwards, which are fixed
  510. when redrawing with CTRL-L, try setting the "c_minlines" internal variable
  511. to a larger number: >
  512.     :let c_minlines = 100
  513. This will make the syntax synchronization start 100 lines before the first
  514. displayed line.  The default value is 50 (15 when c_no_if0 is set).  The
  515. disadvantage of using a larger number is that redrawing can become slow.
  516.  
  517. When using the "#if 0" / "#endif" comment highlighting, notice that this only
  518. works when the "#if 0" is within "c_minlines" from the top of the window.  If
  519. you have a long "#if 0" construct it will not be highlighted correctly.
  520.  
  521. To match extra items in comments, use the cCommentGroup cluster.
  522. Example: >
  523.    :au Syntax c call MyCadd()
  524.    :function MyCadd()
  525.    :  syn keyword cMyItem contained Ni
  526.    :  syn cluster cCommentGroup add=cMyItem
  527.    :  hi link cMyItem Title
  528.    :endfun
  529.  
  530. ANSI constants will be highlighted with the "cConstant" group.  This includes
  531. "NULL", "SIG_IGN" and others.  But not "TRUE", for example, because this is
  532. not in the ANSI standard.  If you find this confusing, remove the cConstant
  533. highlighting: >
  534.     :hi link cConstant NONE
  535.  
  536. If you see '{' and '}' highlighted as an error where they are OK, reset the
  537. highlighting for cErrInParen and cErrInBracket.
  538.  
  539.  
  540. COBOL                        *cobol.vim* *cobol-syntax*
  541.  
  542. COBOL highlighting has different needs for legacy code than it does for fresh
  543. development.  This is due to differences in what is being done (maintenance
  544. versus development) and other factors.  To enable legacy code highlighting,
  545. add this line to your .vimrc: >
  546.     :let cobol_legacy_code=1
  547. To disable it again, use this: >
  548.     :unlet cobol_legacy_code
  549.  
  550.  
  551. COLD FUSION                *coldfusion.vim* *coldfusion-syntax*
  552.  
  553. The ColdFusion has its own version of HTML comments. To turn on ColdFusion
  554. comment highlighting, add the following line to your startup file: >
  555.  
  556.     :let html_wrong_comments=1
  557.  
  558. The ColdFusion syntax file is based on the HTML syntax file.
  559.  
  560.  
  561. CYNLIB                        *cynlib.vim* *cynlib-syntax*
  562.  
  563. Cynlib files are C++ files that use the Cynlib class library to enable
  564. hardware modelling and simulation using C++. Typically Cynlib files have a .cc
  565. or a .cpp extension, which makes it very difficult to distinguish them from a
  566. normal C++ file. Thus, to enable Cynlib highlighting for .cc files, add this
  567. line to your .vimrc file: >
  568.  
  569.     :let cynlib_cyntax_for_cc=1
  570.  
  571. Similarly for cpp files (this extension is only usually used in Windows) >
  572.  
  573.     :let cynlib_cyntax_for_cpp=1
  574.  
  575. To disable these again, use this: >
  576.  
  577.     :unlet cynlib_cyntax_for_cc
  578.     :unlet cynlib_cyntax_for_cpp
  579. <
  580.  
  581. CWEB                        *cweb.vim* *cweb-syntax*
  582.  
  583. Files matching "*.w" could be Progress or cweb.  If the automatic detection
  584. doesn't work for you, or you don't edit Progress at all, use this in your
  585. startup vimrc: >
  586.    :let filetype_w = "cweb"
  587.  
  588.  
  589. DOSBATCH                *dosbatch.vim* *dosbatch-syntax*
  590.  
  591. There is one option with highlighting DOS batch files.  This covers new
  592. extensions to the Command Interpreter introduced with Windows 2000 and
  593. is controlled by the variable dosbatch_cmdextversion.  For Windows NT
  594. this should have the value 1, and for Windows 2000 it should be 2.
  595. Select the version you want with the following line: >
  596.  
  597.   :let dosbatch_cmdextversion = 1
  598.  
  599. If this variable is not defined it defaults to a value of 2 to support
  600. Windows 2000.
  601.  
  602.  
  603. DTD                        *dtd.vim* *dtd-syntax*
  604.  
  605. The DTD syntax highlighting is case sensitive by default. To disable
  606. case-sensitive highlighting, add the following line to your startup file: >
  607.  
  608.     :let dtd_ignore_case=1
  609.  
  610. The DTD syntax file will highlight unknown tags as errors. If
  611. this is annoying, it can be turned off by setting: >
  612.  
  613.     :let dtd_no_tag_errors=1
  614.  
  615. before sourcing the dtd.vim syntax file.
  616. Parameter entity names are highlighted in the definition using the
  617. 'Type' highlighting group and 'Comment' for punctuation and '%'.
  618. Parameter entity instances are highlighted using the 'Constant'
  619. highlighting group and the 'Type' highlighting group for the
  620. delimiters % and ;. This can be turned off by setting: >
  621.  
  622.     :let dtd_no_param_entities=1
  623.  
  624. The DTD syntax file is also included by xml.vim to highlight included dtd's.
  625.  
  626.  
  627. EIFFEL                        *eiffel.vim* *eiffel-syntax*
  628.  
  629. While Eiffel is not case-sensitive, its style guidelines are, and the
  630. syntax highlighting file encourages their use. This also allows to
  631. highlight class names differently. If you want to disable case-sensitive
  632. highlighting, add the following line to your startup file: >
  633.  
  634.     :let eiffel_ignore_case=1
  635.  
  636. Case still matters for class names and TODO marks in comments.
  637.  
  638. Conversely, for even stricter checks, add one of the following lines: >
  639.  
  640.     :let eiffel_strict=1
  641.     :let eiffel_pedantic=1
  642.  
  643. Setting eiffel_strict will only catch improper capitalization for the
  644. five predefined words "Current", "Void", "Result", "Precursor", and
  645. "NONE", to warn against their accidental use as feature or class names.
  646.  
  647. Setting eiffel_pedantic will enforce adherence to the Eiffel style
  648. guidelines fairly rigorously (like arbitrary mixes of upper- and
  649. lowercase letters as well as outdated ways to capitalize keywords).
  650.  
  651. If you want to use the lower-case version of "Current", "Void",
  652. "Result", and "Precursor", you can use >
  653.  
  654.     :let eiffel_lower_case_predef=1
  655.  
  656. instead of completely turning case-sensitive highlighting off.
  657.  
  658. Support for ISE's proposed new creation syntax that is already
  659. experimentally handled by some compilers can be enabled by: >
  660.  
  661.     :let eiffel_ise=1
  662.  
  663. Finally, some vendors support hexadecimal constants. To handle them, add >
  664.  
  665.     :let eiffel_hex_constants=1
  666.  
  667. to your startup file.
  668.  
  669.  
  670. ERLANG                        *erlang.vim* *erlang-syntax*
  671.  
  672. The erlang highlighting supports Erlang (ERicsson LANGuage).
  673. Erlang is case sensitive and default extension is ".erl".
  674.  
  675. If you want to disable keywords highlighting, put in your .vimrc: >
  676.     :let erlang_keywords=1
  677. If you want to disable special characters highlighting, put in
  678. your .vimrc: >
  679.     :let erlang_characters=1
  680.  
  681.  
  682. FORM                        *form.vim* *form-syntax*
  683.  
  684. The coloring scheme for syntax elements in the FORM file uses the default
  685. modes Conditional, Number, Statement, Comment, PreProc, Type, and String,
  686. following the language specifications in 'Symbolic Manipulation with FORM'' by
  687. J.A.M. Vermaseren, CAN, Netherlands, 1991.
  688.  
  689. If you want include your own changes to the default colors, you have to
  690. redefine the following syntax groups:
  691.  
  692.     - formConditional
  693.     - formNumber
  694.     - formStatement
  695.     - formHeaderStatement
  696.     - formComment
  697.     - formPreProc
  698.     - formDirective
  699.     - formType
  700.     - formString
  701.  
  702. Note that the form.vim syntax file implements FORM preprocessor commands and
  703. directives per default in the same syntax group.
  704.  
  705. A predefined enhanced color mode for FORM is available to distinguish between
  706. header statements and statements in the body of a FORM program. To activate
  707. this mode define the following variable in your vimrc file >
  708.  
  709.     :let form_enhanced_color=1
  710.  
  711. The enhanced mode also takes advantage of additional color features for a dark
  712. gvim display. Here, statements are colored LightYellow instead of Yellow, and
  713. conditionals are LightBlue for better distinction.
  714.  
  715.  
  716. FORTRAN                    *fortran.vim* *fortran-syntax*
  717.  
  718. Default highlighting and dialect ~
  719. Highlighting appropriate for f95 (Fortran 95) is used by default. This choice
  720. should be appropriate for most users most of the time because Fortran 95 is a
  721. superset of Fortran 90 and almost a superset of Fortran 77.
  722.  
  723. Fortran source code form ~
  724. Fortran 9x code can be in either fixed or free source form. Note that the
  725. syntax highlighting will not be correct if the form is incorrectly set.
  726.  
  727. When you create a new fortran file, the syntax script assumes fixed source
  728. form. If you always use free source form, then >
  729.     :let fortran_free_source=1
  730. in your .vimrc prior to the :syntax on command.
  731.  
  732. If the form of the source code depends upon the file extension, then it is
  733. most convenient to set fortran_free_source in a ftplugin file. For more
  734. information on ftplugin files, see |ftplugin|. For example, if all your
  735. fortran files with an .f90 extension are written in free source form and the
  736. rest in fixed source form, add the following code to your ftplugin file >
  737.     let s:extfname = expand("%:e")
  738.     if s:extfname ==? "f90"
  739.     let fortran_free_source=1
  740.     else
  741.     unlet! fortran_free_source
  742.     endif
  743.  
  744. When you edit an existing fortran file, the syntax script will assume free
  745. source form if the fortran_free_source variable has been set. If it has not
  746. been set, the syntax script attempts to determine which source form has been
  747. used by examining the first five columns of the first 25 lines of your file.
  748. If no signs of free source form are detected, then the file is assumed to be
  749. in fixed source form. The algorithm should work in the vast majority of cases.
  750. In some cases, such as a file that begins with 25 or more full-line comments,
  751. the script may incorrectly decide that the fortran code is in fixed form. If
  752. that happens, just add a non-comment statement beginning anywhere in the first
  753. five columns of the first twenty five lines, save (:w) and then reload (:e!)
  754. the file.
  755.  
  756. Tabs in fortran files ~
  757. Tabs are not recognized by the Fortran standards. Tabs are not a good idea in
  758. fixed format fortran source code which requires fixed column boundaries.
  759. Therefore, tabs are marked as errors. Nevertheless, some programmers like
  760. using tabs. If your fortran files contain tabs, then you should set the
  761. variable fortran_have_tabs in your .vimrc with a command such as >
  762.     :let fortran_have_tabs=1
  763. placed prior to the :syntax on command. Unfortunately, the use of tabs will
  764. mean that the syntax file will not be able to detect incorrect margins.
  765.  
  766. Syntax folding of fortran files ~
  767. If you wish to use foldmethod=syntax, then you must first set the variable
  768. fortran_fold with a command such as >
  769.     :let fortran_fold=1
  770. to instruct the syntax script to define fold regions for program units, that
  771. is main programs starting with a program statement, subroutines, function
  772. subprograms, block data subprograms, and modules. If you also set the variable
  773. fortran_fold_conditionals with a command such as >
  774.     :let fortran_fold_conditionals=1
  775. then fold regions will also be defined for do loops, if blocks, and select
  776. case constructs. If you also set the variable
  777. fortran_fold_multilinecomments with a command such as >
  778.     :let fortran_fold_multilinecomments=1
  779. then fold regions will also be defined for three or more consecutive comment
  780. lines. Note that defining fold regions can be slow for large files.
  781.  
  782. If fortran_fold, and possibly fortran_fold_conditionals and/or
  783. fortran_fold_multilinecomments, have been set, then vim will fold your file if
  784. you set foldmethod=syntax. Comments or blank lines placed between two program
  785. units are not folded because they are seen as not belonging to any program
  786. unit.
  787.  
  788. More precise fortran syntax ~
  789. If you set the variable fortran_more_precise with a command such as >
  790.     :let fortran_more_precise=1
  791. then the syntax coloring will be more precise but slower. In particular,
  792. statement labels used in do, goto and arithmetic if statements will be
  793. recognized, as will construct names at the end of a do, if, select or forall
  794. construct.
  795.  
  796. Non-default fortran dialects ~
  797. The syntax script supports five Fortran dialects: f95, f90, f77, the Lahey
  798. subset elf90, and the Imagine1 subset F.
  799.  
  800. If you use f77 with extensions, even common ones like do/enddo loops, do/while
  801. loops and free source form that are supported by most f77 compilers including
  802. g77 (GNU Fortran), then you will probably find the default highlighting
  803. satisfactory. However, if you use strict f77 with no extensions, not even free
  804. source form or the MIL STD 1753 extensions, then the advantages of setting the
  805. dialect to f77 are that names such as SUM are recognized as user variable
  806. names and not highlighted as f9x intrinsic functions, that obsolete constructs
  807. such as ASSIGN statements are not highlighted as todo items, and that fixed
  808. source form will be assumed.
  809.  
  810. If you use elf90 or F, the advantage of setting the dialect appropriately is
  811. that f90 features excluded from these dialects will be highlighted as todo
  812. items and that free source form will be assumed as required for these
  813. dialects.
  814.  
  815. The dialect can be selected by setting the variable fortran_dialect. The
  816. permissible values of fortran_dialect are case-sensitive and must be "f95",
  817. "f90", "f77", "elf" or "F". Invalid values of fortran_dialect are ignored.
  818.  
  819. If all your fortran files use the same dialect, set fortran_dialect in your
  820. .vimrc prior to your syntax on statement. If the dialect depends upon the file
  821. extension, then it is most convenient to set it in a ftplugin file. For more
  822. information on ftplugin files, see |ftplugin|. For example, if all your
  823. fortran files with an .f90 extension are written in the elf subset, your
  824. ftplugin file should contain the code >
  825.     let s:extfname = expand("%:e")
  826.     if s:extfname ==? "f90"
  827.     let fortran_dialect="elf"
  828.     else
  829.     unlet! fortran_dialect
  830.     endif
  831.  
  832. Finer control is necessary if the file extension does not uniquely identify
  833. the dialect. You can override the default dialect, on a file-by-file basis, by
  834. including a comment with the directive "fortran_dialect=xx" (where xx=f77 or
  835. elf or F or f90 or f95) in one of the first three lines in your file. For
  836. example, your older .f files may be written in extended f77 but your newer
  837. ones may be F codes, and you would identify the latter by including in the
  838. first three lines of those files a Fortran comment of the form >
  839.   ! fortran_dialect=F
  840. F overrides elf if both directives are present.
  841.  
  842. Limitations ~
  843. Parenthesis checking does not catch too few closing parentheses. Hollerith
  844. strings are not recognized. Some keywords may be highlighted incorrectly
  845. because Fortran90 has no reserved words.
  846.  
  847. For further information related to fortran, see |fortran-indent| and
  848. |fortran-plugin|.
  849.  
  850.  
  851. FVWM CONFIGURATION FILES            *fvwm.vim* *fvwm-syntax*
  852.  
  853. In order for Vim to recognize Fvwm configuration files that do not match
  854. the patterns *fvwmrc* or *fvwm2rc*, you must put additional patterns
  855. appropriate to your system in your myfiletypes.vim file.  For these
  856. patterns, you must set the variable "b:fvwm_version" to the major version
  857. number of Fvwm, and the 'filetype' option to fvwm.
  858.  
  859. For example, to make Vim identify all files in /etc/X11/fvwm2/
  860. as Fvwm2 configuration files, add the following: >
  861.  
  862.   :au! BufNewFile,BufRead /etc/X11/fvwm2/*  let b:fvwm_version = 2 |
  863.                      \ set filetype=fvwm
  864.  
  865. If you'd like Vim to highlight all valid color names, tell it where to
  866. find the color database (rgb.txt) on your system.  Do this by setting
  867. "rgb_file" to its location.  Assuming your color database is located
  868. in /usr/X11/lib/X11/, you should add the line >
  869.  
  870.     :let rgb_file = "/usr/X11/lib/X11/rgb.txt"
  871.  
  872. to your .vimrc file.
  873.  
  874.  
  875. GSP                            *gsp.vim*
  876.  
  877. The default coloring style for GSP pages is defined by |html.vim|, and
  878. the coloring for java code (within java tags or inline between backticks)
  879. is defined by |java.vim|.  The following HTML groups defined in |html.vim|
  880. are redefined to incorporate and highlight inline java code:
  881.  
  882.     htmlString
  883.     htmlValue
  884.     htmlEndTag
  885.     htmlTag
  886.     htmlTagN
  887.  
  888. Highlighting should look fine most of the places where you'd see inline
  889. java code, but in some special cases it may not.  To add another HTML
  890. group where you will have inline java code where it does not highlight
  891. correctly, just copy the line you want from |html.vim| and add gspJava
  892. to the contains clause.
  893.  
  894. The backticks for inline java are highlighted according to the htmlError
  895. group to make them easier to see.
  896.  
  897.  
  898. HTML                        *html.vim* *html-syntax*
  899.  
  900. The coloring scheme for tags in the HTML file works as follows.
  901.  
  902. The  <> of opening tags are colored differently than the </> of a closing tag.
  903. This is on purpose! For opening tags the 'Function' color is used, while for
  904. closing tags the 'Type' color is used (See syntax.vim to check how those are
  905. defined for you)
  906.  
  907. Known tag names are colored the same way as statements in C.  Unknown tag
  908. names are colored with the same color as the <> or </> respectively which
  909. makes it easy to spot errors
  910.  
  911. Note that the same is true for argument (or attribute) names. Known attribute
  912. names are colored differently than unknown ones.
  913.  
  914. Some HTML tags are used to change the rendering of text. The following tags
  915. are recognized by the html.vim syntax coloring file and change the way normal
  916. text is shown: <B> <I> <U> <EM> <STRONG> (<EM> is used as an alias for <I>,
  917. while <STRONG> as an alias for <B>), <H1> - <H6>, <HEAD>, <TITLE> and <A>, but
  918. only if used as a link that is, it must include a href as in
  919. <A href="somfile.html">).
  920.  
  921. If you want to change how such text is rendered, you must redefine the
  922. following syntax groups:
  923.  
  924.     - htmlBold
  925.     - htmlBoldUnderline
  926.     - htmlBoldUnderlineItalic
  927.     - htmlUnderline
  928.     - htmlUnderlineItalic
  929.     - htmlItalic
  930.     - htmlTitle for titles
  931.     - htmlH1 - htmlH6 for headings
  932.  
  933. To make this redefinition work you must redefine them all with the exception
  934. of the last two (htmlTitle and htmlH[1-6], which are optional) and define the
  935. following variable in your vimrc (this is due to the order in which the files
  936. are read during initialization) >
  937.     :let html_my_rendering=1
  938.  
  939. If you'd like to see an example download mysyntax.vim at
  940. http://www.fleiner.com/vim/mysyntax.vim
  941.  
  942. You can also disable this rendering by adding the following line to your
  943. vimrc file: >
  944.     :let html_no_rendering=1
  945.  
  946. HTML comments are rather special (see an HTML reference document for the
  947. details), and the syntax coloring scheme will highlight all errors.
  948. However, if you prefer to use the wrong style (starts with <!-- and
  949. ends with --!>) you can define >
  950.     :let html_wrong_comments=1
  951.  
  952. JavaScript and Visual Basic embedded inside HTML documents are highlighted as
  953. 'Special' with statements, comments, strings and so on colored as in standard
  954. programming languages. Note that only JavaScript and Visual Basic are currently
  955. supported, no other scripting language has been added yet.
  956.  
  957. Embedded and inlined cascading style sheets (CSS) are highlighted too.
  958.  
  959. There are several html preprocessor languages out there. html.vim has been
  960. written such that it should be trivial to include it. To do so add the
  961. following two lines to the syntax coloring file for that language
  962. (the example comes from the asp.vim file):
  963.  
  964.     runtime! syntax/html.vim
  965.     syn cluster htmlPreproc add=asp
  966.  
  967. Now you just need to make sure that you add all regions that contain
  968. the preprocessor language to the cluster htmlPreproc.
  969.  
  970.  
  971. HTML/OS (by Aestiva)                *htmlos.vim* *htmlos-syntax*
  972.  
  973. The coloring scheme for HTML/OS works as follows:
  974.  
  975. Functions and variable names are the same color by default, because VIM
  976. doesn't specify different colors for Functions and Identifiers.  To change
  977. this (which is recommended if you want function names to be recognizable in a
  978. different color) you need to add the following line to either your ~/.vimrc: >
  979.   :hi Function term=underline cterm=bold ctermfg=LightGray
  980.  
  981. Of course, the ctermfg can be a different color if you choose.
  982.  
  983. Another issues that HTML/OS runs into is that there is no special filetype to
  984. signify that it is a file with HTML/OS coding.  You can change this by opening
  985. a file and turning on HTML/OS syntax by doing the following: >
  986.   :set syntax=htmlos
  987.  
  988. Lastly, it should be noted that the opening and closing characters to begin a
  989. block of HTML/OS code can either be << or [[ and >> or ]], respectively.
  990.  
  991.  
  992. IA64                *ia64.vim* *intel-itanium* *ia64-syntax*
  993.  
  994. Highlighting for the Intel Itanium 64 assembly language.  See |asm.vim| for
  995. how to recognize this filetype.
  996.  
  997. To have *.inc files be recognized as IA64, add this to your .vimrc file: >
  998.     :let g:filetype_inc = "ia64"
  999.  
  1000.  
  1001. INFORM                        *inform.vim* *inform-syntax*
  1002.  
  1003. Inform highlighting includes symbols provided by the Inform Library, as
  1004. most programs make extensive use of it.  If do not wish Library symbols
  1005. to be highlighted add this to your vim startup: >
  1006.     :let inform_highlight_simple=1
  1007.  
  1008. By default it is assumed that Inform programs are Z-machine targetted,
  1009. and highlights Z-machine assembly language symbols appropriately.  If
  1010. you intend your program to be targetted to a Glulx/Glk environment you
  1011. need to add this to your startup sequence: >
  1012.     :let inform_highlight_glulx=1
  1013.  
  1014. This will highlight Glulx opcodes instead, and also adds glk() to the
  1015. set of highlighted system functions.
  1016.  
  1017.  
  1018. JAVA                        *java.vim* *java-syntax*
  1019.  
  1020. The java.vim syntax highlighting file offers several options:
  1021.  
  1022. In Java 1.0.2 it was never possible to have braces inside parens, so this was
  1023. flagged as an error.  Since Java 1.1 this is possible (with anonymous
  1024. classes), and therefore is no longer marked as an error. If you prefer the old
  1025. way, put the following line into your vim startup file: >
  1026.     :let java_mark_braces_in_parens_as_errors=1
  1027.  
  1028. All identifiers in java.lang.* are always visible in all classes.  To
  1029. highlight them use: >
  1030.     :let java_highlight_java_lang_ids=1
  1031.  
  1032. You can also highlight identifiers of most standard java packages if you
  1033. download the script at http://www.fleiner.com/vim/syntax/javaid.vim
  1034. If you prefer to only highlight identifiers of a certain package, say java.io
  1035. use the following: >
  1036.     :let java_highligh_java_io=1
  1037. Check the javaid.vim file for a list of all the packages that are supported.
  1038.  
  1039. Function names are not highlighted, as the way to find functions depends on
  1040. how you write java code.  The syntax file knows two possible ways to highlight
  1041. functions:
  1042.  
  1043. If you write function declarations that are always indented by either
  1044. a tab, 8 spaces or 2 spaces you may want to set >
  1045.     :let java_highlight_functions="indent"
  1046. However, if you follow the java guidlines about how functions and classes are
  1047. supposed to be named (with respect to upper and lowercase), use >
  1048.     :let java_highlight_functions="style"
  1049. If both options do not work for you, but you would still want function
  1050. declarations to be highlighted create your own definitions by changing the
  1051. definitions in java.vim or by creating your own java.vim which includes the
  1052. original one and then adds the code to highlight functions.
  1053.  
  1054. In java 1.1 the functions System.out.println() and System.err.println() should
  1055. only be used for debugging. Therefor it is possible to highlight debugging
  1056. statements differently. To do this you must add the following definition in
  1057. your startup file: >
  1058.     :let java_highlight_debug=1
  1059. The result will be that those statements are highlighted as 'Special'
  1060. characters. If you prefer to have them highlighted differently you must define
  1061. new highlightings for the following groups.:
  1062.     Debug, DebugSpecial, DebugString, DebugBoolean, DebugType
  1063. which are used for the statement itself, special characters used in debug
  1064. strings, strings, boolean constants and types (this, super) respectively. I
  1065. have opted to chose another background for those statements.
  1066.  
  1067. In order to help you to write code that can be easely ported between
  1068. java and C++, all C++ keywords are marked as error in a java program.
  1069. However, if you use them regularly, you may want to define the following
  1070. variable in your .vimrc file: >
  1071.     :let java_allow_cpp_keywords=1
  1072.  
  1073. Javadoc is a program that takes special comments out of java program files and
  1074. creates HTML pages. The standard configuration will highlight this HTML code
  1075. similarly to HTML files (see |html.vim|). You can even add javascript
  1076. and CSS inside this code (see below). There are four differences however:
  1077.   1. The title (all characters up to the first '.' which is followed by
  1078.      some white space or up to the first '@') is colored differently (to change
  1079.      the color change the group CommentTitle).
  1080.   2. The text is colored as 'Comment'.
  1081.   3. HTML comments are colored as 'Special'
  1082.   4. The special javadoc tags (@see, @param, ...) are highlighted as specials
  1083.      and the argument (for @see, @param, @exception) as Function.
  1084. To turn this feature off add the following line to your startup file: >
  1085.     :let java_ignore_javadoc=1
  1086.  
  1087. If you use the special javadoc comment highlighting described above you
  1088. can also turn on special highlighting for javascript, visual basic
  1089. scripts and embedded CSS (stylesheets). This makes only sense if you
  1090. actually have javadoc comments that include either javascript or embedded
  1091. CSS. The options to use are >
  1092.     :let java_javascript=1
  1093.     :let java_css=1
  1094.     :let java_vb=1
  1095.  
  1096. If you notice highlighting errors while scrolling backwards, which are fixed
  1097. when redrawing with CTRL-L, try setting the "java_minlines" internal variable
  1098. to a larger number: >
  1099.     :let java_minlines = 50
  1100. This will make the syntax synchronization start 50 lines before the first
  1101. displayed line.  The default value is 10.  The disadvantage of using a larger
  1102. number is that redrawing can become slow.
  1103.  
  1104.  
  1105. LACE                        *lace.vim* *lace-syntax*
  1106.  
  1107. Lace (Language for Assembly of Classes in Eiffel) is case insensitive, but the
  1108. style guide lines are not.  If you prefer case insensitive highlighting, just
  1109. define the vim variable 'lace_case_insensitive' in your startup file: >
  1110.     :let lace_case_insensitive=1
  1111.  
  1112.  
  1113. LEX                        *lex.vim* *lex-syntax*
  1114.  
  1115. Lex uses brute-force synchronizing as the "^%%$" section delimiter
  1116. gives no clue as to what section follows.  Consequently, the value for >
  1117.     :syn sync minlines=300
  1118. may be changed by the user if s/he is experiencing synchronization
  1119. difficulties (such as may happen with large lex files).
  1120.  
  1121.  
  1122. LITE                        *lite.vim* *lite-syntax*
  1123.  
  1124. There are two options for the lite syntax highlighting.
  1125.  
  1126. If you like SQL syntax highligthing inside Strings, use this: >
  1127.  
  1128.     :let lite_sql_query = 1
  1129.  
  1130. For syncing, minlines defaults to 100.  If you prefer another value, you can
  1131. set "lite_minlines" to the value you desire.  Example: >
  1132.  
  1133.     :let lite_minlines = 200
  1134.  
  1135.  
  1136. MAPLE                        *maple.vim* *maple-syntax*
  1137.  
  1138. Maple V, by Waterloo Maple Inc, supports symbolic algebra.  The language
  1139. supports many packages of functions which are selectively loaded by the user.
  1140. The standard set of packages' functions as supplied in Maple V release 4 may be
  1141. highlighted at the user's discretion.  Users may place in their .vimrc file: >
  1142.  
  1143.     :let mvpkg_all= 1
  1144.  
  1145. to get all package functions highlighted, or users may select any subset by
  1146. choosing a variable/package from the table below and setting that variable to
  1147. 1, also in their .vimrc file (prior to sourcing
  1148. $VIMRUNTIME/syntax/syntax.vim).
  1149.  
  1150.     Table of Maple V Package Function Selectors >
  1151.   mv_DEtools     mv_genfunc    mv_networks    mv_process
  1152.   mv_Galois     mv_geometry    mv_numapprox    mv_simplex
  1153.   mv_GaussInt     mv_grobner    mv_numtheory    mv_stats
  1154.   mv_LREtools     mv_group    mv_orthopoly    mv_student
  1155.   mv_combinat     mv_inttrans    mv_padic    mv_sumtools
  1156.   mv_combstruct mv_liesymm    mv_plots    mv_tensor
  1157.   mv_difforms     mv_linalg    mv_plottools    mv_totorder
  1158.   mv_finance     mv_logic    mv_powseries
  1159.  
  1160.  
  1161. MSQL                        *msql.vim* *msql-syntax*
  1162.  
  1163. There are two options for the msql syntax highlighting.
  1164.  
  1165. If you like SQL syntax highligthing inside Strings, use this: >
  1166.  
  1167.     :let msql_sql_query = 1
  1168.  
  1169. For syncing, minlines defaults to 100.  If you prefer another value, you can
  1170. set "msql_minlines" to the value you desire.  Example: >
  1171.  
  1172.     :let msql_minlines = 200
  1173.  
  1174.  
  1175. NCF                        *ncf.vim* *ncf-syntax*
  1176.  
  1177. There is one option for NCF syntax highlighting.
  1178.  
  1179. If you want to have unrecognized (by ncf.vim) statements highlighted as
  1180. errors, use this: >
  1181.  
  1182.     :let ncf_highlight_unknowns = 1
  1183.  
  1184. If you don't want to highlight these errors, leave it unset.
  1185.  
  1186.  
  1187. NROFF                        *nroff.vim* *nroff-syntax*
  1188.  
  1189. To mark trailing spaces as an error, use this:
  1190.  
  1191. >  let nroff_space_errors = 1
  1192.  
  1193.  
  1194. PAPP                        *papp.vim* *papp-syntax*
  1195.  
  1196. The PApp syntax file handles .papp files and, to a lesser extend, .pxml
  1197. and .pxsl files which are all a mixture of perl/xml/html/other using xml
  1198. as the top-level file format. By default everything inside phtml or pxml
  1199. sections is treated as a string with embedded preprocessor commands. If
  1200. you set the variable: >
  1201.  
  1202.     :let papp_include_html=1
  1203.  
  1204. in your startup file it will try to syntax-hilight html code inside phtml
  1205. sections, but this is relatively slow and much too colourful to be able to
  1206. edit sensibly ;)
  1207.  
  1208. The newest version of the papp.vim syntax file can usually be found at
  1209. http://papp.plan9.de.
  1210.  
  1211.  
  1212. PASCAL                        *pascal.vim* *pascal-syntax*
  1213.  
  1214. Files matching "*.p" could be Progress or Pascal.  If the automatic detection
  1215. doesn't work for you, or you don't edit Progress at all, use this in your
  1216. startup vimrc: >
  1217.  
  1218.    :let filetype_p = "pascal"
  1219.  
  1220. The Pascal syntax file has been extended to take into account some extensions
  1221. provided by Turbo Pascal, Free Pascal Compiler and GNU Pascal Compiler.
  1222. Delphi keywords are also supported. By default, Turbo Pascal 7.0 features are
  1223. enabled.  If you prefer to stick with the standard Pascal keywords, add the
  1224. following line to your startup file: >
  1225.  
  1226.    :let pascal_traditional=1
  1227.  
  1228. To switch on Delphi specific constructions (such as one-line comments,
  1229. keywords, etc): >
  1230.  
  1231.    :let pascal_delphi=1
  1232.  
  1233.  
  1234. The option pascal_symbol_operator controls whether symbol operators such as +,
  1235. *, .., etc. are displayed using the Operator color or not.  To colorize symbol
  1236. operators, add the following line to your startup file: >
  1237.  
  1238.    :let pascal_symbol_operator=1
  1239.  
  1240. Some functions are highlighted by default.  To switch it off: >
  1241.  
  1242.    :let pascal_no_functions=1
  1243.  
  1244. Furthermore, there are specific variable for some compiler.  Besides
  1245. pascal_delphi, there are pascal_gpc and pascal_fpc.  Default extensions try to
  1246. match Turbo Pascal. >
  1247.  
  1248.    :let pascal_gpc=1
  1249.  
  1250. or >
  1251.  
  1252.    :let pascal_fpc=1
  1253.  
  1254. To ensure that strings are defined on a single line, you can define the
  1255. pascal_one_line_string variable. >
  1256.  
  1257.    :let pascal_one_line_string=1
  1258.  
  1259. If you dislike <Tab> chars, you can set the pascal_no_tabs variable.  Tabs
  1260. will be highlighted as Error. >
  1261.  
  1262.    :let pascal_no_tabs=1
  1263.  
  1264.  
  1265.  
  1266. PERL                        *perl.vim* *perl-syntax*
  1267.  
  1268. There are a number of possible options to the perl syntax highlighting.
  1269.  
  1270. If you use POD files or POD segments, you might: >
  1271.  
  1272.     :let perl_include_POD = 1
  1273.  
  1274. To handle package references in variable and function names differently from
  1275. the rest of the name (like 'PkgName::' in '$PkgName::VarName'): >
  1276.  
  1277.     :let perl_want_scope_in_variables = 1
  1278.  
  1279. If you want complex things like '@{${"foo"}}' to be parsed: >
  1280.  
  1281.     :let perl_extended_vars = 1
  1282.  
  1283. The coloring strings can be changed. By default strings and qq friends will be
  1284. highlighted like the first line. If you set the variable
  1285. perl_string_as_statement, it will be highlighted as in the second line.
  1286.  
  1287.    "hello world!"; qq|hello world|;
  1288.    ^^^^^^^^^^^^^^NN^^^^^^^^^^^^^^^N       (unlet perl_string_as_statement)
  1289.    S^^^^^^^^^^^^SNNSSS^^^^^^^^^^^^N       (let perl_string_as_statement)
  1290.  
  1291. (^ = perlString, S = perlStatement, N = None at all)
  1292.  
  1293. The syncing has 3 options. The first two switch off some triggering of
  1294. synchronization and should only be needed in case it fails to work properly.
  1295. If while scrolling all of a sudden the whole screen changes color completely
  1296. then you should try and switch off one of those. Let me know if you can figure
  1297. out the line that causes the mistake.
  1298.  
  1299. One triggers on "^\s*sub\s*" and the other on "^[$@%]" more or less. >
  1300.  
  1301.     :let perl_no_sync_on_sub
  1302.     :let perl_no_sync_on_global_var
  1303.  
  1304. Below you can set the maximum distance VIM should look for starting points for
  1305. its attempts in syntax highlighting. >
  1306.  
  1307.     :let perl_sync_dist = 100
  1308.  
  1309. For the "<<xxx" construct (here Documents), Vim can't check for any value of
  1310. "xxx".  If you have a choice use "<<EOF ... EOF", then the highlighting will
  1311. work.
  1312.  
  1313. If you want to use folding with perl, set perl_fold: >
  1314.  
  1315.        :let perl_fold = 1
  1316.  
  1317.  
  1318. PHP3 and PHP4        *php.vim* *php3.vim* *php-syntax* *php3-syntax*
  1319.  
  1320. [note: previously this was called "php3", but since it now also supports php4
  1321. it has been renamed to "php"]
  1322.  
  1323. There are the following options to the php syntax highlighting.
  1324.  
  1325. If you like SQL syntax hightligthing inside Strings: >
  1326.  
  1327.   let php_sql_query = 1
  1328.  
  1329. For highligthing the Baselib methods: >
  1330.  
  1331.   let php_baselib = 1
  1332.  
  1333. Enable HTML syntax highligthing inside strings: >
  1334.  
  1335.   let php_htmlInStrings = 1
  1336.  
  1337. For syncing minlines is being set default to 100. If you
  1338. prefer another value, please make use of something like: >
  1339.  
  1340.   let php_minlines = 200
  1341.  
  1342. Using the old colorstyle: >
  1343.  
  1344.   let php_oldStyle = 1
  1345.  
  1346. Enable parent error highlighting: >
  1347.  
  1348.   let_parentError = 1
  1349.  
  1350. Enable highlighting ASP-style short tags: >
  1351.  
  1352.   let php_asp_tags = 1
  1353.  
  1354. Disable short tags: >
  1355.  
  1356.   let php_noShortTags = 1
  1357.  
  1358.  
  1359. PPWIZARD (preprocessor for HTML and OS/2 INF files) *ppwiz.vim* *ppwiz-syntax*
  1360.  
  1361. This syntax file has the options:
  1362.  
  1363. - ppwiz_highlight_defs : determines highlighting mode for PPWizard's
  1364.   definitions. Possible values are
  1365.  
  1366.   ppwiz_highlight_defs = 1 : PPWizard #define statements retain the
  1367.     colors of their contents (e. g. PPWizard macros and variables)
  1368.  
  1369.   ppwiz_highlight_defs = 2 : preprocessor #define and #evaluate
  1370.     statements are shown in a single color with the exception of line
  1371.     continuation symbols
  1372.  
  1373.   The default setting for ppwiz_highlight_defs is 1.
  1374.  
  1375. - ppwiz_with_html : If the value is 1 (the default), highlight literal
  1376.   HTML code; if 0, treat HTML code like ordinary text.
  1377.  
  1378.  
  1379. PHTML                        *phtml.vim* *phtml-syntax*
  1380.  
  1381. There are two options for the phtml syntax highlighting.
  1382.  
  1383. If you like SQL syntax highligthing inside Strings, use this: >
  1384.  
  1385.     :let phtml_sql_query = 1
  1386.  
  1387. For syncing, minlines defaults to 100.  If you prefer another value, you can
  1388. set "phtml_minlines" to the value you desire.  Example: >
  1389.  
  1390.     :let phtml_minlines = 200
  1391.  
  1392.  
  1393. POSTSCRIPT                    *postscr.vim* *postscr-syntax*
  1394.  
  1395. There are several options when it comes to highlighting PostScript.
  1396.  
  1397. First which version of the PostScript language to highlight.  There are
  1398. currently three defined language versions, or levels.  Level 1 is the original
  1399. and base version, and includes all extensions prior to the release of level 2.
  1400. Level 2 is the most common version around, and includes its own set of
  1401. extensions prior to the release of level 3.  Level 3 is currently the highest
  1402. level supported.  You select which level of the PostScript language you want
  1403. highlighted by defining the postscr_level variable as follows: >
  1404.  
  1405.     :let postscr_level=2
  1406.  
  1407. If this variable is not defined it defaults to 2 (level 2) since this is
  1408. the most prevalent version currently.
  1409.  
  1410. Note, not all PS interpreters will support all language features for a
  1411. particular language level.  In particular the %!PS-Adobe-3.0 at the start of
  1412. PS files does NOT mean the PostScript present is level 3 PostScript!
  1413.  
  1414. If you are working with Display PostScript, you can include highlighting of
  1415. Display PS language features by defining the postscr_display variable as
  1416. follows: >
  1417.  
  1418.     :let postscr_display=1
  1419.  
  1420. If you are working with Ghostscript, you can include highlighting of
  1421. Ghostscript specific language features by defining the variable
  1422. postscr_ghostscript as follows: >
  1423.  
  1424.     :let postscr_ghostscript=1
  1425.  
  1426. PostScript is a large language, with many predefined elements.  While it
  1427. useful to have all these elements highlighted, on slower machines this can
  1428. cause Vim to slow down.  In an attempt to be machine friendly font names and
  1429. character encodings are not highlighted by default.  Unless you are working
  1430. explicitly with either of these this should be ok.  If you want them to be
  1431. highlighted you should set one or both of the following variables: >
  1432.  
  1433.     :let postscr_fonts=1
  1434.     :let postscr_encodings=1
  1435.  
  1436. There is a stylistic option to the highlighting of and, or, and not.  In
  1437. PostScript the function of these operators depends on the types of their
  1438. operands - if the operands are booleans then they are the logical operators,
  1439. if they are integers then they are binary operators.  As binary and logical
  1440. operators can be highlighted differently they have to be highlighted one way
  1441. or the other.  By default they are treated as logical operators.  They can be
  1442. highlighted as binary operators by defining the variable
  1443. postscr_andornot_binary as follows: >
  1444.  
  1445.     :let postscr_andornot_binary=1
  1446. <
  1447.  
  1448.             *ptcap.vim*
  1449. PRINTCAP + TERMCAP    *ptcap-syntax* *termcap-syntax* *printcap-syntax*
  1450.  
  1451. This syntax file applies to the printcap and termcap databases.
  1452.  
  1453. In order for Vim to recognize printcap/termcap files that do not match
  1454. the patterns *printcap*, or *termcap*, you must put additional patterns
  1455. appropriate to your system in your |myfiletypefile| file.  For these
  1456. patterns, you must set the variable "b:ptcap_type" to either "print" or
  1457. "term", and then the 'filetype' option to ptcap.
  1458.  
  1459. For example, to make Vim identify all files in /etc/termcaps/ as termcap
  1460. files, add the following: >
  1461.  
  1462.    :au BufNewFile,BufRead /etc/termcaps/* let b:ptcap_type = "term" |
  1463.                        \ set filetype=ptcap
  1464.  
  1465. If you notice highlighting errors while scrolling backwards, which
  1466. are fixed when redrawing with CTRL-L, try setting the "ptcap_minlines"
  1467. internal variable to a larger number:
  1468.  
  1469.   let ptcap_minlines = 50
  1470.  
  1471. (The default is 20 lines.)
  1472.  
  1473.  
  1474. PROGRESS                *progress.vim* *progress-syntax*
  1475.  
  1476. Files matching "*.w" could be Progress or cweb.  If the automatic detection
  1477. doesn't work for you, or you don't edit cweb at all, use this in your
  1478. startup vimrc: >
  1479.    :let filetype_w = "progress"
  1480. The same happens for "*.i", which could be assembly, and "*.p", which could be
  1481. Pascal.  Use this if you don't use assembly and Pascal: >
  1482.    :let filetype_i = "progress"
  1483.    :let filetype_p = "progress"
  1484.  
  1485.  
  1486. PYTHON                        *python.vim* *python-syntax*
  1487.  
  1488. There are four options to control Python syntax highlighting.
  1489.  
  1490. For highlighted numbers: >
  1491.     :let python_highlight_numbers = 1
  1492.  
  1493. For highlighted builtin functions: >
  1494.     :let python_highlight_builtins = 1
  1495.  
  1496. For highlighted standard exceptions: >
  1497.     :let python_highlight_exceptions = 1
  1498.  
  1499. If you want all possible Python highlighting (the same as setting the
  1500. preceding three options): >
  1501.     :let python_highlight_all = 1
  1502.  
  1503.  
  1504. REXX                        *rexx.vim* *rexx-syntax*
  1505.  
  1506. If you notice highlighting errors while scrolling backwards, which are fixed
  1507. when redrawing with CTRL-L, try setting the "rexx_minlines" internal variable
  1508. to a larger number: >
  1509.     :let rexx_minlines = 50
  1510. This will make the syntax synchronization start 50 lines before the first
  1511. displayed line.  The default value is 10.  The disadvantage of using a larger
  1512. number is that redrawing can become slow.
  1513.  
  1514.  
  1515. RUBY                        *ruby.vim* *ruby-syntax*
  1516.  
  1517. There are a few options to the Ruby syntax highlighting.
  1518.  
  1519. By default, the "end" keyword is colorized according to the opening statement
  1520. of the block it closes. While useful, this feature can be expensive: if you
  1521. experience slow redrawing (or you are on a terminal with poor color support)
  1522. you may want to turn it off by defining the "ruby_no_expensive" variable: >
  1523.     :let ruby_no_expensive = 1
  1524. In this case the same color will be used for all control keywords.
  1525.  
  1526. If you do want this feature enabled, but notice highlighting errors while
  1527. scrolling backwards, which are fixed when redrawing with CTRL-L, try setting
  1528. the "ruby_minlines" variable to a value larger than 50: >
  1529.     :let ruby_minlines = 100
  1530. Ideally, this value should be a number of lines large enough to embrace your
  1531. largest class or module.
  1532.  
  1533. Finally, if you do not like to see too many color items around, you can define
  1534. "ruby_no_identifiers": >
  1535.     :let ruby_no_identifiers = 1
  1536. This will prevent highlighting of special identifiers like "ConstantName",
  1537. "$global_var", "@instace_var", "| iterator |", and ":symbol".
  1538.  
  1539.  
  1540. SDL                        *sdl.vim* *sdl-syntax*
  1541.  
  1542. The SDL highlighting probably misses a few keywords, but SDL has so many
  1543. of them it's almost impossibly to cope.
  1544.  
  1545. The new standard, SDL-2000, specifies that all identifiers are
  1546. case-sensitive (which was not so before), and that all keywords can be
  1547. used either completely lowercase or completely uppercase. To have the
  1548. highlighting reflect this, you can set the following variable: >
  1549.     :let sdl_2000=1
  1550.  
  1551. This also sets many new keywords. If you want to disable the old
  1552. keywords, which is probably a good idea, use: >
  1553.     :let SDL_no_96=1
  1554.  
  1555.  
  1556. The indentation is probably also incomplete, but right now I am very
  1557. satisfied with it for my own projects.
  1558.  
  1559. The last thing is a little PO-editing helper. It adds a couple of menu
  1560. entries. Though it doesn't do much, I find it extremely helpful for
  1561. translating PO files. I just won't use Emacs, you know.
  1562.  
  1563.  
  1564. SED                        *sed.vim* *sed-syntax*
  1565.  
  1566. To make tabs stand out from regular blanks (accomplished by using Todo
  1567. highlighting on the tabs), define "highlight_sedtabs" by putting >
  1568.  
  1569.     :let highlight_sedtabs = 1
  1570.  
  1571. in the vimrc file.  (This special highlighting only applies for tabs
  1572. inside search patterns, replacement texts, addresses or text included
  1573. by an Append/Change/Insert command.)  If you enable this option, it is
  1574. also a good idea to set the tab width to one character; by doing that,
  1575. you can easily count the number of tabs in a string.
  1576.  
  1577. Bugs:
  1578.  
  1579.   The transform command (y) is treated exactly like the substitute
  1580.   command.  This means that, as far as this syntax file is concerned,
  1581.   transform accepts the same flags as substitute, which is wrong.
  1582.   (Transform accepts no flags.)  I tolerate this bug because the
  1583.   involved commands need very complex treatment (95 patterns, one for
  1584.   each plausible pattern delimiter).
  1585.  
  1586.  
  1587. SGML                        *sgml.vim* *sgml-syntax*
  1588.  
  1589. The coloring scheme for tags in the SGML file works as follows.
  1590.  
  1591. The <> of opening tags are colored differently than the </> of a closing tag.
  1592. This is on purpose! For opening tags the 'Function' color is used, while for
  1593. closing tags the 'Type' color is used (See syntax.vim to check how those are
  1594. defined for you)
  1595.  
  1596. Known tag names are colored the same way as statements in C.  Unknown tag
  1597. names are not colored which makes it easy to spot errors.
  1598.  
  1599. Note that the same is true for argument (or attribute) names. Known attribute
  1600. names are colored differently than unknown ones.
  1601.  
  1602. Some SGML tags are used to change the rendering of text. The following tags
  1603. are recognized by the sgml.vim syntax coloring file and change the way normal
  1604. text is shown: <varname> <emphasis> <command> <function> <literal>
  1605. <replaceable> <ulink> and <link>.
  1606.  
  1607. If you want to change how such text is rendered, you must redefine the
  1608. following syntax groups:
  1609.  
  1610.     - sgmlBold
  1611.     - sgmlBoldItalic
  1612.     - sgmlUnderline
  1613.     - sgmlItalic
  1614.     - sgmlLink for links
  1615.  
  1616. To make this redefinition work you must redefine them all and define the
  1617. following variable in your vimrc (this is due to the order in which the files
  1618. are read during initialization) >
  1619.    let sgml_my_rendering=1
  1620.  
  1621. You can also disable this rendering by adding the following line to your
  1622. vimrc file: >
  1623.    let sgml_no_rendering=1
  1624.  
  1625. (Adapted from the html.vim help text by Claudio Fleiner <claudio@fleiner.com>)
  1626.  
  1627.  
  1628. SH                        *sh.vim* *sh-syntax*
  1629.  
  1630. This covers the "normal" Unix (Borne) sh, bash and the korn shell.
  1631.  
  1632. Vim attempts to determine which shell type is in use by specifying that
  1633. various filenames are of specific types:
  1634.  
  1635.     ksh : .kshrc* *.ksh
  1636.     bash: .bashrc* bashrc bash.bashrc .bash_profile* *.bash
  1637.  
  1638. If neither of these cases pertain, then the first line of the file is examined
  1639. (ex. /bin/sh  /bin/ksh  /bin/bash).  If the first line specifies a shelltype,
  1640. then that shelltype is used.  However some files (ex. .profile) are known to
  1641. be shell files but the type is not apparent.  One may specify buffer specific
  1642. variables prior to sourcing the <sh.vim> syntax file (b:is_kornshell,
  1643. b:is_bash, or b:is_sh) so that the associated shell type will be used.  One
  1644. may also specify a global default by instantiating one of the following
  1645. three variables:
  1646.  
  1647.     ksh : is_kornshell
  1648.     bash: is_bash
  1649.     sh  : is_sh
  1650.  
  1651. One may also specify that what looks like the "sh" shell is actually
  1652. to be interpreted as a bash shell by setting 'bash_is_sh'.  It is
  1653. best to set any of these global variables in your '.vimrc' file.
  1654.  
  1655. To choose between the two ways to treat single-quotes inside a pair of
  1656. double-quotes, I have introduced a Vim variable "highlight_balanced_quotes".
  1657. By default (ie by not declaring this variable) single quotes can be used
  1658. inside double quotes, and are not highlighted.  If you prefer balanced single
  1659. quotes as I do you just make the statement in your .vimrc file: >
  1660.     :let highlight_balanced_quotes = 1
  1661.  
  1662. Similarly I have introduced another vim variable "highlight_function_name" to be
  1663. used to enable/disable highlighting of the function-name in function
  1664. declarations.  The default is not to highlight the function name.  If you want to
  1665. highlight function names, include this in your .vimrc file: >
  1666.     :let highlight_function_name = 1
  1667.  
  1668. If you notice highlighting errors while scrolling backwards, which are fixed
  1669. when redrawing with CTRL-L, try setting the "sh_minlines" internal variable
  1670. to a larger number: >
  1671.     :let sh_minlines = 200
  1672. This will make the syntax synchronization start 200 lines before the first
  1673. displayed line.  The default value is 100.  The disadvantage of using a larger
  1674. number is that redrawing can become slow.
  1675.  
  1676. If you don't have much to synchronize on, displaying can be very slow.  To
  1677. reduce this, the "sh_maxlines" internal variable can be set: >
  1678.     :let sh_maxlines = 100
  1679. The default is to use the double of "sh_minlines".  Set it to a smaller number
  1680. to speed up displaying.  The disadvantage is that highlight errors may appear.
  1681.  
  1682.  
  1683. SPEEDUP (AspenTech plant simulator)        *spup.vim* *spup-syntax*
  1684.  
  1685. The Speedup syntax file has some options:
  1686.  
  1687. - strict_subsections : If this variable is defined, only keywords for
  1688.   sections and subsections will be highlighted as statements but not
  1689.   other keywords (like WITHIN in the OPERATION section).
  1690.  
  1691. - highlight_types : Definition of this variable causes stream types
  1692.   like temperature or pressure to be highlighted as Type, not as a
  1693.   plain Identifier. Included are the types that are usually found in
  1694.   the DECLARE section; if you defined own types, you have to include
  1695.   them in the syntax file.
  1696.  
  1697. - oneline_comments : this value ranges from 1 to 3 and determines the
  1698.   highlighting of # style comments.
  1699.  
  1700.   oneline_comments = 1 : allow normal Speedup code after an even
  1701.   number of #s.
  1702.  
  1703.   oneline_comments = 2 : show code starting with the second # as
  1704.   error. This is the default setting.
  1705.  
  1706.   oneline_comments = 3 : show the whole line as error if it contains
  1707.   more than one #.
  1708.  
  1709. Since especially OPERATION sections tend to become very large due to
  1710. PRESETting variables, syncing may be critical. If your computer is
  1711. fast enough, you can increase minlines and/or maxlines near the end of
  1712. the syntax file.
  1713.  
  1714.  
  1715. TEX                        *tex.vim* *tex-syntax*
  1716.  
  1717. The tex highlighting supports TeX, LaTeX, and some AmsTeX.  The
  1718. highlighting supports three primary zones: normal, texZone, and texMathZone.
  1719. Although a considerable effort has been made to have these zones terminate
  1720. properly, zones delineated by $..$ and $$..$$ cannot be synchronized as
  1721. there's no difference between start and end patterns.  Consequently, a
  1722. special "TeX comment" has been provided >
  1723.     %stopzone
  1724. which will forcibly terminate the highlighting of either a texZone or a
  1725. texMathZone.
  1726.  
  1727. If you have a slow computer, you may wish to reduce the values for >
  1728.     :syn sync maxlines=200
  1729.     :syn sync minlines=50
  1730. (especially the latter).  If your computer is fast, you may wish to
  1731. increase them.  This primarily affects synchronizing (ie. just what group,
  1732. if any, is the text at the top of the screen supposed to be in?).
  1733.  
  1734. The <tex.vim> supports lexical error checking of various sorts.  Thus,
  1735. although the error checking is ofttimes very useful, it can indicate
  1736. errors where none actually are.  If this proves to be a problem for you,
  1737. you may put in your <.vimrc> the following statement: >
  1738.     let tex_no_error=1
  1739. and all error checking by <tex.vim> will be suppressed.
  1740.  
  1741.  
  1742. TF                        *tf.vim* *tf-syntax*
  1743.  
  1744. There is one option for the tf syntax highlighting.
  1745.  
  1746. For syncing, minlines defaults to 100.  If you prefer another value, you can
  1747. set "tf_minlines" to the value you desire.  Example: >
  1748.  
  1749.     :let tf_minlines = your choice
  1750.  
  1751.  
  1752. X Pixmaps (XPM)                    *xpm.vim* *xpm-syntax*
  1753.  
  1754. xpm.vim creates its syntax items dynamically based upon the contents of the
  1755. XPM file.  Thus if you make changes e.g. in the color specification strings,
  1756. you have to source it again e.g. with ":set syn=xpm".
  1757.  
  1758. To copy a pixel with one of the colors, yank a "pixel" with "yl" and insert it
  1759. somewhere else with "P".
  1760.  
  1761. Do you want to draw with the mouse?  Try the following: >
  1762.    :function! GetPixel()
  1763.    :   let c = getline(line("."))[col(".") - 1]
  1764.    :   echo c
  1765.    :   exe "noremap <LeftMouse> <LeftMouse>r".c
  1766.    :   exe "noremap <LeftDrag>  <LeftMouse>r".c
  1767.    :endfunction
  1768.    :noremap <RightMouse> <LeftMouse>:call GetPixel()<CR>
  1769.    :set guicursor=n:hor20       " to see the color beneath the cursor
  1770. This turns the right button into a pipette and the left button into a pen.
  1771. It will work with XPM files that have one character per pixel only and you
  1772. must not click outside of the pixel strings, but feel free to improve it.
  1773.  
  1774. It will look much better with a font in a quadratic cell size, e.g. for X: >
  1775.     :set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-*
  1776.  
  1777. ==============================================================================
  1778. 5. Defining a syntax                    *:syn-define* *E410*
  1779.  
  1780. Vim understands three types of syntax items:
  1781.  
  1782. 1. Keyword.
  1783.    It can only contain keyword characters, according to the 'iskeyword'
  1784.    option.  It cannot contain other syntax items.  It will only match with a
  1785.    complete word (there are no keyword characters before or after the match).
  1786.    The keyword "if" would match in "if(a=b)", but not in "ifdef x", because
  1787.    "(" is not a keyword character and "d" is.
  1788.  
  1789. 2. Match.
  1790.    This is a match with a single regexp pattern.
  1791.  
  1792. 3. Region.
  1793.    This starts at a match of the "start" regexp pattern and ends with a match
  1794.    with the "end" regexp pattern.  Any other text can appear in between.  A
  1795.    "skip" regexp pattern can be used to avoid matching the "end" pattern.
  1796.  
  1797. Several syntax ITEMs can be put into one syntax GROUP.  For a syntax group
  1798. you can give highlighting attributes.  For example, you could have an item
  1799. to define a "/* .. */" comment and another one that defines a "// .." comment,
  1800. and put them both in the "Comment" group.  You can then specify that a
  1801. "Comment" will be in bold font and have a blue color.  You are free to make
  1802. one highlight group for one syntax item, or put all items into one group.
  1803. This depends on how you want to specify your highlighting attributes.  Putting
  1804. each item in its own group results in having to specify the highlighting
  1805. for a lot of groups.
  1806.  
  1807. Note that a syntax group and a highlight group are similar.  For a highlight
  1808. group you will have given highlight attributes.  These attributes will be used
  1809. for the syntax group with the same name.
  1810.  
  1811. In case more than one item matches at the same position, the one that was
  1812. defined LAST wins.  Thus you can override previously defined syntax items by
  1813. using an item that matches the same text.  But a keyword always goes before a
  1814. match or region.  And a keyword with matching case always goes before a
  1815. keyword with ignoring case.
  1816.  
  1817.  
  1818. DEFINING CASE                        *:syn-case* *E390*
  1819.  
  1820. :sy[ntax] case [match|ignore]
  1821.     This defines if the following ":syntax" commands will work with
  1822.     matching case, when using "match", or with ignoring case, when using
  1823.     "ignore".  Note that any items before this are not affected, and all
  1824.     items until the next ":syntax case" command are affected.
  1825.  
  1826.  
  1827. DEFINING KEYWORDS                    *:syn-keyword*
  1828.  
  1829. :sy[ntax] keyword {group-name} [{options}] {keyword} .. [{options}]
  1830.  
  1831.     This defines a number of keywords.
  1832.  
  1833.     {group-name}    Is a syntax group name such as "Comment".
  1834.     [{options}]    See |:syn-arguments| below.
  1835.     {keyword} ..    Is a list of keywords which are part of this group.
  1836.  
  1837.     Example: >
  1838.   :syntax keyword   Type   int long char
  1839. <
  1840.     The {options} can be given anywhere in the line.  They will apply to
  1841.     all keywords given, also for options that come after a keyword.
  1842.     These examples do exactly the same: >
  1843.   :syntax keyword   Type   contained int long char
  1844.   :syntax keyword   Type   int long contained char
  1845.   :syntax keyword   Type   int long char contained
  1846. <
  1847.     When you have a keyword with an optional tail, like Ex commands in
  1848.     Vim, you can put the optional characters inside [], to define all the
  1849.     variations at once: >
  1850.   :syntax keyword   VimCommand   ab[breviate] n[ext]
  1851. <
  1852.     Don't forget that a keyword can only be recognized if all the
  1853.     characters are included in the 'iskeyword' option.  If one character
  1854.     isn't, the keyword will never be recognized.
  1855.     Multi-byte characters can also be used.  These do not have to be in
  1856.     'iskeyword'.
  1857.  
  1858.     A keyword always has higher priority than a match or region, the
  1859.     keyword is used if more than one item matches.  Keywords do not nest
  1860.     and a keyword can't contain anything else.
  1861.  
  1862.     Note that when you have a keyword that is the same as an option (even
  1863.     one that isn't allowed here), you can not use it.  Use a match
  1864.     instead.
  1865.  
  1866.     The maximum length of a keyword is 80 characters.
  1867.  
  1868.     The same keyword can be defined multiple times, when its containment
  1869.     differs.  For example, you can define the keyword once not contained
  1870.     and use one highlight group, and once contained, and use a different
  1871.     highlight group. Example: >
  1872.   :syn keyword vimCommand tag
  1873.   :syn keyword vimSetting contained tag
  1874. <    When finding "tag" outside of any syntax item, the "vimCommand"
  1875.     highlight group is used.  When finding "tag" in a syntax item that
  1876.     contains "vimSetting", the "vimSetting" group is used.
  1877.  
  1878.  
  1879. DEFINING MATCHES                    *:syn-match*
  1880.  
  1881. :sy[ntax] match {group-name} [{options}] [excludenl] {pattern} [{options}]
  1882.  
  1883.     This defines one match.
  1884.  
  1885.     {group-name}        A syntax group name such as "Comment".
  1886.     [{options}]        See |:syn-arguments| below.
  1887.     [excludenl]        Don't make a pattern with the end-of-line "$"
  1888.                 extend a containing match or region.  Must be
  1889.                 given before the pattern. |:syn-excludenl|
  1890.     {pattern}        The search pattern that defines the match.
  1891.                 See |:syn-pattern| below.
  1892.                 Note that the pattern may match more than one
  1893.                 line, which makes the match depend on where
  1894.                 Vim starts searching for the pattern.  You
  1895.                 need to make sure syncing takes care of this.
  1896.  
  1897.     Example (match a character constant): >
  1898.   :syntax match Character /'.'/s+1e-1
  1899. <
  1900.  
  1901. DEFINING REGIONS    *:syn-region* *:syn-start* *:syn-skip* *:syn-end*
  1902.                             *E398* *E399*
  1903. :sy[ntax] region {group-name} [{options}]
  1904.         [matchgroup={group_name}]
  1905.         [keepend]
  1906.         [extend]
  1907.         [excludenl]
  1908.         start={start_pattern} ..
  1909.         [skip={skip_pattern}]
  1910.         end={end_pattern} ..
  1911.         [{options}]
  1912.  
  1913.     This defines one region.  It may span several lines.
  1914.  
  1915.     {group-name}        A syntax group name such as "Comment".
  1916.     [{options}]        See |:syn-arguments| below.
  1917.     [matchgroup={group-name}]  The syntax group to use for the following
  1918.                 start or end pattern matches only.  Not used
  1919.                 for the text in between the matched start and
  1920.                 end patterns.  Use NONE to reset to not using
  1921.                 a different group for the start or end match.
  1922.                 See |:syn-matchgroup|.
  1923.     keepend            Don't allow contained matches to go past a
  1924.                 match with the end pattern.  See
  1925.                 |:syn-keepend|.
  1926.     extend            Override a "keepend" for an item this region
  1927.                 is contained in. See |:syn-extend|.
  1928.     excludenl        Don't make a pattern with the end-of-line "$"
  1929.                 extend a containing match or item.  Only
  1930.                 useful for end patterns.  Must be given before
  1931.                 the patterns it applies to. |:syn-excludenl|
  1932.     start={start_pattern}    The search pattern that defines the start of
  1933.                 the region.  See |:syn-pattern| below.
  1934.     skip={skip_pattern}    The search pattern that defines text inside
  1935.                 the region where not to look for the end
  1936.                 pattern.  See |:syn-pattern| below.
  1937.     end={end_pattern}    The search pattern that defines the end of
  1938.                 the region.  See |:syn-pattern| below.
  1939.  
  1940.     Example: >
  1941.   :syntax region String   start=+"+  skip=+\\"+  end=+"+
  1942. <
  1943.     The start/skip/end patterns and the options can be given in any order.
  1944.     There can be zero or one skip pattern.  There must be one or more
  1945.     start and end patterns.  This means that you can omit the skip
  1946.     pattern, but you must give at least one start and one end pattern.  It
  1947.     is allowed to have white space before and after the equal sign
  1948.     (although it mostly looks better without white space).
  1949.  
  1950.     When more than one start pattern is given, a match with one of these
  1951.     is sufficient.  This means there is an OR relation between the start
  1952.     patterns.  The last one that matches is used.  The same is true for
  1953.     the end patterns.
  1954.  
  1955.     The search for the end pattern starts right after the start pattern.
  1956.     Offsets are not used for this.  This implies that the match for the
  1957.     end pattern will never overlap with the start pattern.
  1958.  
  1959.     The skip and end pattern can match across line breaks, but since the
  1960.     search for the pattern can start in any line it often does not do what
  1961.     you want.  The skip pattern doesn't avoid a match of an end pattern in
  1962.     the next line.  Use single-line patterns to avoid trouble.
  1963.  
  1964.     Note: The decision to start a region is only based on a matching start
  1965.     pattern.  There is no check for a matching end pattern.  This does NOT
  1966.     work: >
  1967.         :syn region First  start="("  end=":"
  1968.         :syn region Second start="("  end=";"
  1969. <    The Second always matches before the First (last defined pattern has
  1970.     higher priority).  The Second region then continues until the next
  1971.     ';', no matter if there is a ':' before it.  Using a match does work: >
  1972.         :syn match First  "(\_.\{-}:"
  1973.         :syn match Second "(\_.\{-};"
  1974. <    This pattern matches any character or line break with "\_." and
  1975.     repeats that with "\{-}" (repeat as few as possible).
  1976.  
  1977.                             *:syn-keepend*
  1978.     By default, a contained match can obscure a match for the end pattern.
  1979.     This is useful for nesting.  For example, a region that starts with
  1980.     "{" and ends with "}", can contain another region.  An encountered "}"
  1981.     will then end the contained region, but not the outer region:
  1982.         {        starts outer "{}" region
  1983.         {    starts contained "{}" region
  1984.         }    ends contained "{}" region
  1985.         }        ends outer "{} region
  1986.     If you don't want this, the "keepend" argument will make the matching
  1987.     of an end pattern of the outer region also end any contained item.
  1988.     This makes it impossible to nest the same region, but allows for
  1989.     contained items to highlight parts of the end pattern, without causing
  1990.     that to skip the match with the end pattern.  Example: >
  1991.   :syn match  VimComment +"[^"]\+$+
  1992.   :syn region VimCommand start="set" end="$" contains=VimComment keepend
  1993. <    The "keepend" makes the VimCommand always end at the end of the line,
  1994.     even though the contained VimComment includes a match with the <EOL>.
  1995.  
  1996.     When "keepend" is not used, a match with an end pattern is retried
  1997.     after each contained match.  When "keepend" is included, the first
  1998.     encountered match with an end pattern is used, truncating any
  1999.     contained matches.
  2000.                             *:syn-extend*
  2001.     The "keepend" behavior can be changed by using the "extend" argument.
  2002.     When an item with "extend" is contained in an item that uses
  2003.     "keepend", the "keepend" is ignored and the containing region will be
  2004.     extended.
  2005.     This can be used to have some contained items extend a region while
  2006.     others don't.  Example: >
  2007.  
  2008.    :syn region htmlRef start=+<a>+ end=+</a>+ keepend contains=htmlItem,htmlScript
  2009.    :syn match htmlItem +<[^>]*>+ contained
  2010.    :syn region htmlScript start=+<script+ end=+</script[^>]*>+ contained extend
  2011.  
  2012. <    Here the htmlItem item does not make the htmlRef item continue
  2013.     further, it is only used to highlight the <> items.  The htmlScript
  2014.     item does extend the htmlRef item.
  2015.  
  2016.     Another example: >
  2017.    :syn region xmlFold start="<a>" end="</a>" fold transparent keepend extend
  2018. <    This defines a region with "keepend", so that its end cannot be
  2019.     changed by contained items, like when the "</a>" is matched to
  2020.     highlight it differently.  But when the xmlFold region is nested (it
  2021.     includes itself), the "extend" applies, so that the "</a>" of a nested
  2022.     region only ends that region, and not the one it is contained in.
  2023.  
  2024.                             *:syn-excludenl*
  2025.     When a pattern for a match or end pattern of a region includes a '$'
  2026.     to match the end-of-line, it will make a region item that it is
  2027.     contained in continue on the next line.  For example, a match with
  2028.     "\\$" (backslash at the end of the line) can make a region continue
  2029.     that would normally stop at the end of the line.  This is the default
  2030.     behavior.  If this is not wanted, there are two ways to avoid it:
  2031.     1. Use "keepend" for the containing item.  This will keep all
  2032.        contained matches from extending the match or region.  It can be
  2033.        used when all contained items must not extend the containing item.
  2034.     2. Use "excludenl" in the contained item.  This will keep that match
  2035.        from extending the containing match or region.  It can be used if
  2036.        only some contained items must not extend the containing item.
  2037.        "excludenl" must be given before the pattern it applies to.
  2038.  
  2039.                             *:syn-matchgroup*
  2040.     "matchgroup" can be used to highlight the start and/or end pattern
  2041.     differently than the body of the region.  Example: >
  2042.   :syntax region String matchgroup=Quote start=+"+  skip=+\\"+  end=+"+
  2043. <    This will highlight the quotes with the "Quote" group, and the text in
  2044.     between with the "String" group.
  2045.     The "matchgroup" is used for all start and end patterns that follow,
  2046.     until the next "matchgroup".  Use "matchgroup=NONE" to go back to not
  2047.     using a matchgroup.
  2048.  
  2049.     In a start or end pattern that is highlighted with "matchgroup" the
  2050.     contained items of the region are not used.  This can be used to avoid
  2051.     that a contained item matches in the start or end pattern match.  When
  2052.     using "transparent", this does not apply to a start or end pattern
  2053.     match that is highlighted with "matchgroup".
  2054.  
  2055.     Here is an example, which highlights three levels of parentheses in
  2056.     different colors: >
  2057.    :sy region par1 matchgroup=par1 start=/(/ end=/)/ contains=par2
  2058.    :sy region par2 matchgroup=par2 start=/(/ end=/)/ contains=par3 contained
  2059.    :sy region par3 matchgroup=par3 start=/(/ end=/)/ contains=par1 contained
  2060.    :hi par1 ctermfg=red guifg=red
  2061.    :hi par2 ctermfg=blue guifg=blue
  2062.    :hi par3 ctermfg=darkgreen guifg=darkgreen
  2063.  
  2064. ==============================================================================
  2065. 6. :syntax arguments                    *:syn-arguments*
  2066.  
  2067. The :syntax commands that define syntax items take a number of arguments.
  2068. The common ones are explained here.  The arguments may be given in any order
  2069. and may be mixed with patterns.
  2070.  
  2071. Not all commands accept all arguments.  This table shows which arguments
  2072. can not be used for all commands:
  2073.                             *E395* *E396*
  2074.             contains  oneline    fold  display  extend~
  2075. :syntax keyword         -     -     -     -     -
  2076. :syntax match        yes     -    yes    yes    yes
  2077. :syntax region        yes    yes    yes    yes    yes
  2078.  
  2079. These arguments can be used for all three commands:
  2080.     contained
  2081.     containedin
  2082.     nextgroup
  2083.     transparent
  2084.     skipwhite
  2085.     skipnl
  2086.     skipempty
  2087.  
  2088.  
  2089. contained                        *:syn-contained*
  2090.  
  2091. When the "contained" argument is given, this item will not be recognized at
  2092. the top level, but only when it is mentioned in the "contains" field of
  2093. another match.  Example: >
  2094.    :syntax keyword Todo    TODO    contained
  2095.    :syntax match   Comment "//.*"  contains=Todo
  2096.  
  2097.  
  2098. display                            *:syn-display*
  2099.  
  2100. If the "display" argument is given, this item will be skipped when the
  2101. detected highlighting will not be displayed.  This will speed up highlighting,
  2102. by skipping this item when only finding the syntax state for the text that is
  2103. to be dislayed.
  2104.  
  2105. Generally, you can use "display" for match and region items that meet these
  2106. conditions:
  2107. - The item does not continue past the end of a line.  Example for C: A region
  2108.   for a "/*" comment can't contain "display", because it continues on the next
  2109.   line.
  2110. - The item does not contain items that continue past the end of the line or
  2111.   make it continue on the next line.
  2112. - The item does not change the size of any item it is contained in.  Example
  2113.   for C: A match with "\\$" in a preprocessor match can't have "display",
  2114.   because it may make that preprocessor match shorter.
  2115. - The item does not allow other items to match that didn't match otherwise,
  2116.   and that item may extend the match too far.  Example for C: A match for a
  2117.   "//" comment can't use "display", because a "/*" inside that comment would
  2118.   match then and start a comment which extends past the end of the line.
  2119.  
  2120. Examples, for the C language, where "display" can be used:
  2121. - match with a number
  2122. - match with a label
  2123.  
  2124.  
  2125. transparent                        *:syn-transparent*
  2126.  
  2127. If the "transparent" argument is given, this item will not be highlighted
  2128. itself, but will take the highlighting of the item it is contained in.  This
  2129. is useful for syntax items that don't need any highlighting but are used
  2130. only to skip over a part of the text.
  2131.  
  2132. The "contains=" argument is also inherited from the item it is contained in,
  2133. unless a "contains" argument is given for the transparent item itself.  To
  2134. avoid that unwanted items are contained, use "contains=NONE".  Example, which
  2135. highlights words in strings, but makes an exception for "vim": >
  2136.     :syn match myString /'[^']*'/ contains=myWord,myVim
  2137.     :syn match myWord   /\<[a-z]*\>/ contained
  2138.     :syn match myVim    /\<vim\>/ transparent contained contains=NONE
  2139.     :hi link myString String
  2140.     :hi link myWord   Comment
  2141. Since the "myVim" match comes after "myWord" it is the preferred match (last
  2142. match in the same position overrules an earlier one).  The "transparent"
  2143. argument makes the "myVim" match use the same highlighting as "myString".  But
  2144. it does not contain anything.  If the "contains=NONE" argument would be left
  2145. out, then "myVim" would use the contains argument from myString and allow
  2146. "myWord" to be contained, which will be highlighted as a Constant.  This
  2147. happens because a contained match doesn't match inside itself in the same
  2148. position, thus the "myVim" match doesn't overrule the "myWord" match here.
  2149.  
  2150. When you look at the colored text, it is like looking at layers of contained
  2151. items.  The contained item is on top of the item it is contained in, thus you
  2152. see the contained item.  When a contained item is transparent, you can look
  2153. through, thus you see the item it is contained in.  In a picture:
  2154.  
  2155.         look from here
  2156.  
  2157.         |    |   |    |   |    |
  2158.         V    V   V    V   V    V
  2159.  
  2160.            xxxx      yyy        more contained items
  2161.         ....................    contained item (transparent)
  2162.     =============================    first item
  2163.  
  2164. The 'x', 'y' and '=' represent a highlighted syntax item.  The '.' represent a
  2165. transparent group.
  2166.  
  2167. What you see is:
  2168.  
  2169.     =======xxxx=======yyy========
  2170.  
  2171. Thus you look through the transparent "....".
  2172.  
  2173.  
  2174. oneline                            *:syn-oneline*
  2175.  
  2176. The "oneline" argument indicates that the region does not cross a line
  2177. boundary.  It must match completely in the current line.  However, when the
  2178. region has a contained item that does cross a line boundary, it continues on
  2179. the next line anyway.  A contained item can be used to recognize a line
  2180. continuation pattern.
  2181.  
  2182. When the start pattern includes a "\n" to match an end-of-line, the end
  2183. pattern must found in the same line as where the start pattern ends.  The end
  2184. pattern may also include an end-of-line.  Thus the "oneline" argument
  2185. means that the end of the start pattern and the start of the end pattern must
  2186. be within one line.  This can't be changed by a skip pattern that matches a
  2187. line break.
  2188.  
  2189.  
  2190. fold                            *:syn-fold*
  2191.  
  2192. The "fold" argument makes the fold level increased by one for this item.
  2193. Example: >
  2194.    :syn region myFold start="{" end="}" transparent fold
  2195.    :syn sync fromstart
  2196.    :set foldmethod=syntax
  2197. This will make each {} block form one fold.
  2198.  
  2199. The fold will start on the line where the item starts, and end where the item
  2200. ends.  If the start and end are within the same line, there is no fold.
  2201. The 'foldnestmax' option limits the nesting of syntax folds.
  2202. {not available when Vim was compiled without |+folding| feature}
  2203.  
  2204.  
  2205.             *:syn-contains* *E405* *E406* *E407* *E408* *E409*
  2206. contains={groupname},..
  2207.  
  2208. The "contains" argument is followed by a list of syntax group names.  These
  2209. groups will be allowed to begin inside the item (they may extend past the
  2210. containing group's end).  This allows for recursive nesting of matches and
  2211. regions.  If there is no "contains" argument, no groups will be contained in
  2212. this item.  The group names do not need to be defined before they can be used
  2213. here.
  2214.  
  2215. contains=ALL
  2216.         If the only item in the contains list is "ALL", then all
  2217.         groups will be accepted inside the item.
  2218.  
  2219. contains=ALLBUT,{group-name},..
  2220.         If the first item in the contains list is "ALLBUT", then all
  2221.         groups will be accepted inside the item, except the ones that
  2222.         are listed.  Example: >
  2223.   :syntax region Block start="{" end="}" ... contains=ALLBUT,Function
  2224.  
  2225. contains=TOP
  2226.         If the first item in the contains list is "TOP", then all
  2227.         groups will be accepted that don't have the "contained"
  2228.         argument.
  2229. contains=TOP,{group-name},..
  2230.         Like "TOP", but excluding the groups that are listed.
  2231.  
  2232. contains=CONTAINED
  2233.         If the first item in the contains list is "CONTAINED", then
  2234.         all groups will be accepted that have the "contained"
  2235.         argument.
  2236. contains=CONTAINED,{group-name},..
  2237.         Like "CONTAINED", but excluding the groups that are
  2238.         listed.
  2239.  
  2240.  
  2241. The {group-name} in the "contains" list can be a pattern.  All group names
  2242. that match the pattern will be included (or excluded, if "ALLBUT" is used).
  2243. The pattern cannot contain white space or a ','.  Example: >
  2244.    ... contains=Comment.*,Keyw[0-3]
  2245. The matching will be done at moment the syntax command is executed.  Groups
  2246. that are defined later will not be matched.  Also, if the current syntax
  2247. command defines a new group, it is not matched.  Be careful: When putting
  2248. syntax commands in a file you can't rely on groups NOT being defined, because
  2249. the file may have been sourced before, and ":syn clear" doesn't remove the
  2250. group names.
  2251.  
  2252. The contained groups will also match in the start and end patterns of a
  2253. region.  If this is not wanted, the "matchgroup" argument can be used
  2254. |:syn-matchgroup|.  The "ms=" and "me=" offsets can be used to change the
  2255. region where contained items do match.  Note that this may also limit the
  2256. area that is highlighted
  2257.  
  2258.  
  2259. containedin={groupname}...                *:syn-containedin*
  2260.  
  2261. The "containedin" argument is followed by a list of syntax group names.  The
  2262. item will be allowed to begin inside these groups.  This works as if the
  2263. containing item has a "contains=" argument that includes this item.
  2264.  
  2265. The {groupname}... can be used just like for "contains", as explained above.
  2266.  
  2267. This is useful when adding a syntax item afterwards.  An item can be told to
  2268. be included inside an already existing item, without changing the definition
  2269. of that item.  For example, to highlight a word in a C comment after loading
  2270. the C syntax: >
  2271.     :syn keyword myword HELP containedin=cComment contained
  2272. Note that "contained" is also used, to avoid that the item matches at the top
  2273. level.
  2274.  
  2275. Matches for "containedin" are added to the other places where the item can
  2276. appear.  A "contains" argument may also be added as usual.  Don't forget that
  2277. keywords never contain another item, thus adding them to "containedin" won't
  2278. work.
  2279.  
  2280.  
  2281. nextgroup={groupname},..                *:syn-nextgroup*
  2282.  
  2283. The "nextgroup" argument is followed by a list of syntax group names,
  2284. separated by commas (just like with "contains", so you can also use patterns).
  2285.  
  2286. If the "nextgroup" argument is given, the mentioned syntax groups will be
  2287. tried for a match, after the match or region ends.  If none of the groups have
  2288. a match, highlighting continues normally.  If there is a match, this group
  2289. will be used, even when it is not mentioned in the "contains" field of the
  2290. current group.  This is like giving the mentioned group priority over all
  2291. other groups.  Example: >
  2292.    :syntax match  ccFoobar  "Foo.\{-}Bar"  contains=ccFoo
  2293.    :syntax match  ccFoo     "Foo"        contained nextgroup=ccFiller
  2294.    :syntax region ccFiller  start="."  matchgroup=ccBar  end="Bar"  contained
  2295.  
  2296. This will highlight "Foo" and "Bar" differently, and only when there is a
  2297. "Bar" after "Foo".  In the text line below, "f" shows where ccFoo is used for
  2298. highlighting, and "bbb" where ccBar is used. >
  2299.  
  2300.    Foo asdfasd Bar asdf Foo asdf Bar asdf
  2301.    fff           bbb      fff      bbb
  2302.  
  2303. Note the use of ".\{-}" to skip as little as possible until the next Bar.
  2304. when ".*" would be used, the "asdf" in between "Bar" and "Foo" would be
  2305. highlighted according to the "ccFoobar" group, because the ccFooBar match
  2306. would include the first "Foo" and the last "Bar" in the line (see |pattern|).
  2307.  
  2308.  
  2309. skipwhite                        *:syn-skipwhite*
  2310. skipnl                            *:syn-skipnl*
  2311. skipempty                        *:syn-skipempty*
  2312.  
  2313. These arguments are only used in combination with "nextgroup".  They can be
  2314. used to allow the next group to match after skipping some text:
  2315.     skipwhite    skip over space and Tab characters
  2316.     skipnl        skip over the end of a line
  2317.     skipempty    skip over empty lines (implies a "skipnl")
  2318.  
  2319. When "skipwhite" is present, the white space is only skipped if there is no
  2320. next group that matches the white space.
  2321.  
  2322. When "skipnl" is present, the match with nextgroup may be found in the next
  2323. line.  This only happens when the current item ends at the end of the current
  2324. line!  When "skipnl" is not present, the nextgroup will only be found after
  2325. the current item in the same line.
  2326.  
  2327. When skipping text while looking for a next group, the matches for other
  2328. groups are ignored.  Only when no next group matches, other items are tried
  2329. for a match again.  This means that matching a next group and skipping white
  2330. space and <EOL>s has a higher priority than other items.
  2331.  
  2332. Example: >
  2333.   :syn match ifstart "if.*"     nextgroup=ifline skipwhite skipempty
  2334.   :syn match ifline  "endif"    contained
  2335.   :syn match ifline  "[^ \t].*" nextgroup=ifline skipwhite skipempty contained
  2336. Note that the last match, which matches any non-white text, is put last,
  2337. otherwise the "endif" of the indent would never match, because the "[^ \t].*"
  2338. would match first.
  2339. Note that this example doesn't work for nested "if"s.  You need to add
  2340. "contains" arguments to make that work (omitted for simplicity of the
  2341. example).
  2342.  
  2343. ==============================================================================
  2344. 7. Syntax patterns                *:syn-pattern* *E401* *E402*
  2345.  
  2346. In the syntax commands, a pattern must be surrounded by two identical
  2347. characters.  This is like it works for the ":s" command.  The most common to
  2348. use is the double quote.  But if the pattern contains a double quote, you can
  2349. use another character that is not used in the pattern.  Examples: >
  2350.   :syntax region Comment  start="/\*"  end="\*/"
  2351.   :syntax region String   start=+"+    end=+"+   skip=+\\"+
  2352.  
  2353. See |pattern| for the explanation of what a pattern is.  Syntax patterns are
  2354. always interpreted like the 'magic' options is set, no matter what the actual
  2355. value of 'magic' is.  And the patterns are interpreted like the 'l' flag is
  2356. not included in 'cpoptions'.  This was done to make syntax files portable and
  2357. independent of 'compatible' and 'magic' settings.
  2358.  
  2359. Try to avoid patterns that can match an empty string, such as "[a-z]*".
  2360. This slows down the highlighting a lot, because it matches everywhere.
  2361.  
  2362.                         *:syn-pattern-offset*
  2363. The pattern can be followed by a character offset.  This can be used to
  2364. change the highlighted part, and to change the text area included in the
  2365. match or region (which only matters when trying to match other items).  Both
  2366. are relative to the matched pattern.  The character offset for a skip
  2367. pattern can be used to tell where to continue looking for an end pattern.
  2368.  
  2369. The offset takes the form of "{what}={offset}"
  2370. The {what} can be one of seven strings:
  2371.  
  2372. ms    Match Start    offset for the start of the matched text
  2373. me    Match End    offset for the end of the matched text
  2374. hs    Highlight Start    offset for where the highlighting starts
  2375. he    Highlight End    offset for where the highlighting ends
  2376. rs    Region Start    offset for where the body of a region starts
  2377. re    Region End    offset for where the body of a region ends
  2378. lc    Leading Context    offset past "leading context" of pattern
  2379.  
  2380. The {offset} can be:
  2381.  
  2382. s    start of the matched pattern
  2383. s+{nr}    start of the matched pattern plus {nr} chars to the right
  2384. s-{nr}    start of the matched pattern plus {nr} chars to the left
  2385. e    end of the matched pattern
  2386. e+{nr}    end of the matched pattern plus {nr} chars to the right
  2387. e-{nr}    end of the matched pattern plus {nr} chars to the left
  2388. {nr}    (for "lc" only): start matching {nr} chars to the left
  2389.  
  2390. Examples: "ms=s+1", "hs=e-2", "lc=3".
  2391.  
  2392. Although all offsets are accepted after any pattern, they are not always
  2393. meaningful.  This table shows which offsets are actually used:
  2394.  
  2395.             ms   me   hs   he   rs   re      lc ~
  2396. match item        yes  yes  yes  yes  -    -    yes
  2397. region item start   yes  -    yes  -    yes  -    yes
  2398. region item skip    -    yes  -    -    -    -    yes
  2399. region item end     -    yes  -    yes  -    yes  yes
  2400.  
  2401. Offsets can be concatenated, with a ',' in between.  Example: >
  2402.   :syn match String  /"[^"]*"/hs=s+1,he=e-1
  2403. <
  2404.     some "string" text
  2405.       ^^^^^^        highlighted
  2406.  
  2407. Notes:
  2408. - There must be no white space between the pattern and the character
  2409.   offset(s).
  2410. - The highlighted area will never be outside of the matched text.
  2411. - A negative offset for an end pattern may not always work, because the end
  2412.   pattern may be detected when the highlighting should already have stopped.
  2413. - The start of a match cannot be in a line other than where the pattern
  2414.   matched.  This doesn't work: "a\nb"ms=e.  You can make the highlighting
  2415.   start in another line, this does work: "a\nb"hs=e.
  2416.  
  2417. Example (match a comment but don't highlight the /* and */): >
  2418.   :syntax region Comment start="/\*"hs=e+1 end="\*/"he=s-1
  2419. <
  2420.     /* this is a comment */
  2421.       ^^^^^^^^^^^^^^^^^^^     highlighted
  2422.  
  2423. A more complicated Example: >
  2424.   :syn region Exa matchgroup=Foo start="foo"hs=s+2,rs=e+2 matchgroup=Bar end="bar"me=e-1,he=e-1,re=s-1
  2425. <
  2426.      abcfoostringbarabc
  2427.         mmmmmmmmmmm        match
  2428.           ssrrrreee        highlight start/region/end ("Foo", "Exa" and "Bar")
  2429.  
  2430. Leading context            *:syn-lc* *:syn-leading* *:syn-context*
  2431.  
  2432. Note: This is an obsolete feature, only included for backwards compatibility
  2433. with previous Vim versions.  It's now recommended to use the |/\@<=| construct
  2434. in the pattern.
  2435.  
  2436. The "lc" offset specifies leading context -- a part of the pattern that must
  2437. be present, but is not considered part of the match.  An offset of "lc=n" will
  2438. cause Vim to step back n columns before attempting the pattern match, allowing
  2439. characters which have already been matched in previous patterns to also be
  2440. used as leading context for this match.  This can be used, for instance, to
  2441. specify that an "escaping" character must not precede the match: >
  2442.  
  2443.   :syn match ZNoBackslash "[^\\]z"ms=s+1
  2444.   :syn match WNoBackslash "[^\\]w"lc=1
  2445.   :syn match Underline "_\+"
  2446. <
  2447.       ___zzzz ___wwww
  2448.       ^^^     ^^^      matches Underline
  2449.           ^ ^      matches ZNoBackslash
  2450.              ^^^^ matches WNoBackslash
  2451.  
  2452. The "ms" offset is automatically set to the same value as the "lc" offset,
  2453. unless you set "ms" explicitly.
  2454.  
  2455.  
  2456. Multi-line patterns                    *:syn-multi-line*
  2457.  
  2458. The patterns can include "\n" to match an end-of-line.  Mostly this works as
  2459. expected, but there are a few exceptions.
  2460.  
  2461. When using a start pattern with an offset, the start of the match is not
  2462. allowed to start in a following line.  The highlighting can start in a
  2463. following line though.
  2464.  
  2465. The skip pattern can include the "\n", but the search for an end pattern will
  2466. continue in the first character of the next line, also when that character is
  2467. matched by the skip pattern.  This is because redrawing may start in any line
  2468. halfway a region and there is no check if the skip pattern started in a
  2469. previous line.  For example, if the skip pattern is "a\nb" and an end pattern
  2470. is "b", the end pattern does match in the second line of this: >
  2471.      x x a
  2472.      b x x
  2473. Generally this means that the skip pattern should not match any characters
  2474. after the "\n".
  2475.  
  2476.  
  2477. External matches                    *:syn-ext-match*
  2478.  
  2479. These extra regular expression items are available in region patterns:
  2480.  
  2481.                         */\z(* */\z(\)* *E50* *E52*
  2482.     \z(\)    Marks the sub-expression as "external", meaning that it is can
  2483.         be accessed from another pattern match.  Currently only usable
  2484.         in defining a syntax region start pattern.
  2485.  
  2486.     \z1  ...  \z9                */\z1* */\z2* *\z9* *E66* *E67*
  2487.         Matches the same string that was matched by the corresponding
  2488.         sub-expression in a previous start pattern match.
  2489.  
  2490. Sometimes the start and end patterns of a region need to share a common
  2491. sub-expression.  A common example is the "here" document in Perl and many Unix
  2492. shells.  This effect can be achieved with the "\z" special regular expression
  2493. items, which marks a sub-expression as "external", in the sense that it can be
  2494. referenced from outside the pattern in which it is defined.  The here-document
  2495. example, for instance, can be done like this: >
  2496.   :syn region hereDoc start="<<\z(\I\i*\)" end="^\z1$"
  2497.  
  2498. As can be seen here, the \z actually does double duty.  In the start pattern,
  2499. it marks the "\(\I\i*\)" sub-expression as external; in the end pattern, it
  2500. changes the \1 back-reference into an external reference referring to the
  2501. first external sub-expression in the start pattern.  External references can
  2502. also be used in skip patterns: >
  2503.   :syn region foo start="start \(\I\i*\)" skip="not end \z1" end="end \z1"
  2504.  
  2505. Note that normal and external sub-expressions are completely orthogonal and
  2506. indexed separately; for instance, if the pattern "\z(..\)\(..\)" is applied
  2507. to the string "aabb", then \1 will refer to "bb" and \z1 will refer to "aa".
  2508. Note also that external sub-expressions cannot be accessed as back-references
  2509. within the same pattern like normal sub-expressions.  If you want to use one
  2510. sub-expression as both a normal and an external sub-expression, you can nest
  2511. the two, as in "\(\z(...\)\)".
  2512.  
  2513. Note that only matches within a single line can be used.  Multi-line matches
  2514. cannot be referred to.
  2515.  
  2516. ==============================================================================
  2517. 8. Syntax clusters                    *:syn-cluster* *E400*
  2518.  
  2519. :sy[ntax] cluster {cluster-name} [contains={group-name}..]
  2520.                  [add={group-name}..]
  2521.                  [remove={group-name}..]
  2522.  
  2523. This command allows you to cluster a list of syntax groups together under a
  2524. single name.
  2525.  
  2526.     contains={group-name}..
  2527.         The cluster is set to the specified list of groups.
  2528.     add={group-name}..
  2529.         The specified groups are added to the cluster.
  2530.     remove={group-name}..
  2531.         The specified groups are removed from the cluster.
  2532.  
  2533. A cluster so defined may be referred to in a contains=.., nextgroup=.., add=..
  2534. or remove=.. list with a "@" prefix.  You can also use this notation to
  2535. implicitly declare a cluster before specifying its contents.
  2536.  
  2537. Example: >
  2538.    :syntax match Thing "# [^#]\+ #" contains=@ThingMembers
  2539.    :syntax cluster ThingMembers contains=ThingMember1,ThingMember2
  2540.  
  2541. As the previous example suggests, modifications to a cluster are effectively
  2542. retroactive; the membership of the cluster is checked at the last minute, so
  2543. to speak: >
  2544.    :syntax keyword A aaa
  2545.    :syntax cluster AandB contains=A
  2546.    :syntax match Stuff "( aaa bbb )" contains=@AandB
  2547.    :syntax cluster AandB add=B    " now both keywords are matched in Stuff
  2548.  
  2549. This also has implications for nested clusters: >
  2550.    :syntax keyword A aaa
  2551.    :syntax keyword B bbb
  2552.    :syntax cluster SmallGroup contains=B
  2553.    :syntax cluster BigGroup contains=A,@SmallGroup
  2554.    :syntax match Stuff "( aaa bbb )" contains=@BigGroup
  2555.    :syntax cluster BigGroup remove=B    " no effect, since B isn't in BigGroup
  2556.    :syntax cluster SmallGroup remove=B  " now bbb isn't matched within Stuff
  2557.  
  2558. ==============================================================================
  2559. 9. Including syntax files                *:syn-include* *E397*
  2560.  
  2561. It is often useful for one language's syntax file to include a syntax file for
  2562. a related language.  Depending on the exact relationship, this can be done in
  2563. two different ways:
  2564.  
  2565.     - If top-level syntax items in the included syntax file are to be
  2566.       allowed at the top level in the including syntax, you can simply use
  2567.       the |:runtime| command: >
  2568.  
  2569.   " In cpp.vim:
  2570.   :runtime! syntax/c.vim
  2571.   :unlet b:current_syntax
  2572.  
  2573. <    - If top-level syntax items in the included syntax file are to be
  2574.       contained within a region in the including syntax, you can use the
  2575.       ":syntax include" command:
  2576.  
  2577. :sy[ntax] include [@{grouplist-name}] {file-name}
  2578.  
  2579.       All syntax items declared in the included file will have the
  2580.       "contained" flag added.  In addition, if a group list is specified,
  2581.       all top-level syntax items in the included file will be added to
  2582.       that list. >
  2583.  
  2584.    " In perl.vim:
  2585.    :syntax include @Pod <sfile>:p:h/pod.vim
  2586.    :syntax region perlPOD start="^=head" end="^=cut" contains=@Pod
  2587. <
  2588.       When {file-name} is an absolute path (starts with "/", "c:", "$VAR"
  2589.       or "<sfile>") that file is sourced.  When it is a relative path
  2590.       (e.g., "syntax/pod.vim") the file is searched for in 'runtimepath'.
  2591.       All matching files are loaded.  Using a relative path is
  2592.       recommended, because it allows a user to replace the included file
  2593.       with his own version, without replacing the file that does the ":syn
  2594.       include".
  2595.  
  2596. ==============================================================================
  2597. 10. Synchronizing                    *:syn-sync* *E403* *E404*
  2598.  
  2599. Vim wants to be able to start redrawing in any position in the document.  To
  2600. make this possible it needs to know the syntax item at the position where
  2601. redrawing starts.
  2602.  
  2603. :sy[ntax] sync [ccomment [group-name] | minlines={N} | ...]
  2604.  
  2605. There are four ways to synchronize:
  2606. 1. Always parse from the start of the file.
  2607.    |:syn-sync-first|
  2608. 2. Based on C-style comments.  Vim understands how C-comments work and can
  2609.    figure out if the current line starts inside or outside a comment.
  2610.    |:syn-sync-second|
  2611. 3. Jumping back a certain number of lines and start parsing there.
  2612.    |:syn-sync-third|
  2613. 4. Searching backwards in the text for a pattern to sync on.
  2614.    |:syn-sync-fourth|
  2615.  
  2616.                 *:syn-sync-maxlines* *:syn-sync-minlines*
  2617. For the last three methods, the line range where the parsing can start is
  2618. limited by "minlines" and "maxlines".
  2619.  
  2620. If the "minlines={N}" argument is given, the parsing always starts at least
  2621. that many lines backwards.  This can be used if the parsing may take a few
  2622. lines before it's correct, or when it's not possible to use syncing.
  2623.  
  2624. If the "maxlines={N}" argument is given, the number of lines that are searched
  2625. for a comment or syncing pattern is restricted to N lines backwards (after
  2626. adding "minlines".  This is useful if you have few things to sync on and a
  2627. slow machine.  Example: >
  2628.    :syntax sync ccomment maxlines=500
  2629.  
  2630.  
  2631. First syncing method:            *:syn-sync-first*
  2632. >
  2633.    :syntax sync fromstart
  2634.  
  2635. The file will be parsed from the start.  This makes syntax highlighting
  2636. accurate, but can be slow for long files.  Vim caches previously parsed text,
  2637. so that it's only slow when parsing the text for the first time.  However,
  2638. when making changes some part of the next needs to be parsed again (worst
  2639. case: to the end of the file).
  2640.  
  2641. Using "fromstart" is equivalent to using "minlines" with a very large number.
  2642.  
  2643.  
  2644. Second syncing method:            *:syn-sync-second* *:syn-sync-ccomment*
  2645.  
  2646. For the second method, only the "ccomment" argument needs to be given.
  2647. Example: >
  2648.    :syntax sync ccomment
  2649.  
  2650. When Vim finds that the line where displaying starts is inside a C-style
  2651. comment, the last region syntax item with the group-name "Comment" will be
  2652. used.  This requires that there is a region with the group-name "Comment"!
  2653. An alternate group name can be specified, for example: >
  2654.    :syntax sync ccomment javaComment
  2655. This means that the last item specified with "syn region javaComment" will be
  2656. used for the detected C comment region.  This only works properly if that
  2657. region does have a start pattern "\/*" and an end pattern "*\/".
  2658.  
  2659. The "maxlines" argument can be used to restrict the search to a number of
  2660. lines.  The "minlines" argument can be used to at least start a number of
  2661. lines back (e.g., for when there is some construct that only takes a few
  2662. lines, but it hard to sync on).
  2663.  
  2664. Note: Syncing on a C comment doesn't work properly when strings are used
  2665. that cross a line and contain a "*/".  Since letting strings cross a line
  2666. is a bad programming habit (many compilers give a warning message), and the
  2667. chance of a "*/" appearing inside a comment is very small, this restriction
  2668. is hardly ever noticed.
  2669.  
  2670.  
  2671. Third syncing method:                *:syn-sync-third*
  2672.  
  2673. For the third method, only the "minlines={N}" argument needs to be given.
  2674. Vim will subtract {N} from the line number and start parsing there.  This
  2675. means {N} extra lines need to be parsed, which makes this method a bit slower.
  2676. Example: >
  2677.    :syntax sync minlines=50
  2678.  
  2679. "lines" is equivalent to "minlines" (used by older versions).
  2680.  
  2681.  
  2682. Fourth syncing method:                *:syn-sync-fourth*
  2683.  
  2684. The idea is to synchronize on the end of a few specific regions, called a
  2685. sync pattern.  Only regions can cross lines, so when we find the end of some
  2686. region, we might be able to know in which syntax item we are.  The search
  2687. starts in the line just above the one where redrawing starts.  From there
  2688. the search continues backwards in the file.
  2689.  
  2690. This works just like the non-syncing syntax items.  You can use contained
  2691. matches, nextgroup, etc.  But there are a few differences:
  2692. - Keywords cannot be used.
  2693. - The syntax items with the "sync" keyword form a completely separated group
  2694.   of syntax items.  You can't mix syncing groups and non-syncing groups.
  2695. - The matching works backwards in the buffer (line by line), instead of
  2696.   forwards.
  2697. - A line continuation pattern can be given.  It is used to decide which group
  2698.   of lines need to be searched like they were one line.  This means that the
  2699.   search for a match with the specified items starts in the first of the
  2700.   consecutive that contain the continuation pattern.
  2701. - When using "nextgroup" or "contains", this only works within one line (or
  2702.   group of continued lines).
  2703. - When using a region, it must start and end in the same line (or group of
  2704.   continued lines).  Otherwise the end is assumed to be at the end of the
  2705.   line (or group of continued lines).
  2706. - When a match with a sync pattern is found, the rest of the line (or group of
  2707.   continued lines) is searched for another match.  The last match is used.
  2708.   This is used when a line can contain both the start end the end of a region
  2709.   (e.g., in a C-comment like /* this */, the last "*/" is used).
  2710.  
  2711. There are two ways how a match with a sync pattern can be used:
  2712. 1. Parsing for highlighting starts where redrawing starts (and where the
  2713.    search for the sync pattern started).  The syntax group that is expected
  2714.    to be valid there must be specified.  This works well when the regions
  2715.    that cross lines cannot contain other regions.
  2716. 2. Parsing for highlighting continues just after the match.  The syntax group
  2717.    that is expected to be present just after the match must be specified.
  2718.    This can be used when the previous method doesn't work well.  It's much
  2719.    slower, because more text needs to be parsed.
  2720. Both types of sync patterns can be used at the same time.
  2721.  
  2722. Besides the sync patterns, other matches and regions can be specified, to
  2723. avoid finding unwanted matches.
  2724.  
  2725. [The reason that the sync patterns are given separately, is that mostly the
  2726. search for the sync point can be much simpler than figuring out the
  2727. highlighting.  The reduced number of patterns means it will go (much)
  2728. faster.]
  2729.  
  2730.                         *syn-sync-grouphere* *E393* *E394*
  2731.     :syntax sync match {sync-group-name} grouphere {group-name} "pattern" ..
  2732.  
  2733.     Define a match that is used for syncing.  {group-name} is the
  2734.     name of a syntax group that follows just after the match.  Parsing
  2735.     of the text for highlighting starts just after the match.  A region
  2736.     must exist for this {group-name}.  The first one defined will be used.
  2737.     "NONE" can be used for when there is no syntax group after the match.
  2738.  
  2739.                         *syn-sync-groupthere*
  2740.     :syntax sync match {sync-group-name} groupthere {group-name} "pattern" ..
  2741.  
  2742.     Like "grouphere", but {group-name} is the name of a syntax group that
  2743.     is to be used at the start of the line where searching for the sync
  2744.     point started.  The text between the match and the start of the sync
  2745.     pattern searching is assumed not to change the syntax highlighting.
  2746.     For example, in C you could search backwards for "/*" and "*/".  If
  2747.     "/*" is found first, you know that you are inside a comment, so the
  2748.     "groupthere" is "cComment".  If "*/" is found first, you know that you
  2749.     are not in a comment, so the "groupthere" is "NONE".  (in practice
  2750.     it's a bit more complicated, because the "/*" and "*/" could appear
  2751.     inside a string.  That's left as an exercise to the reader...).
  2752.  
  2753.     :syntax sync match ..
  2754.     :syntax sync region ..
  2755.  
  2756.     Without a "groupthere" argument.  Define a region or match that is
  2757.     skipped while searching for a sync point.
  2758.  
  2759.     :syntax sync linecont {pattern}
  2760.  
  2761.     When {pattern} matches in a line, it is considered to continue in
  2762.     the next line.  This means that the search for a sync point will
  2763.     consider the lines to be concatenated.
  2764.  
  2765. If the "maxlines={N}" argument is given too, the number of lines that are
  2766. searched for a match is restricted to N.  This is useful if you have very
  2767. few things to sync on and a slow machine.  Example: >
  2768.    :syntax sync maxlines=100
  2769.  
  2770. You can clear all sync settings with: >
  2771.    :syntax sync clear
  2772.  
  2773. You can clear specific sync patterns with: >
  2774.    :syntax sync clear {sync-group-name} ..
  2775.  
  2776. ==============================================================================
  2777. 11. Listing syntax items        *:syntax* *:sy* *:syn* *:syn-list*
  2778.  
  2779. This commands lists all the syntax items: >
  2780.  
  2781.     :sy[ntax] [list]
  2782.  
  2783. To show the syntax items for one syntax group: >
  2784.  
  2785.     :sy[ntax] list {group-name}
  2786.  
  2787. To list the syntax groups in one cluster:            *E392*  >
  2788.  
  2789.     :sy[ntax] list @{cluster-name}
  2790.  
  2791. See above for other arguments for the ":syntax" command.
  2792.  
  2793. Note that the ":syntax" command can be abbreviated to ":sy", although ":syn"
  2794. is mostly used, because it looks better.
  2795.  
  2796. ==============================================================================
  2797. 12. Highlight command            *:highlight* *:hi* *E28* *E411* *E415*
  2798.  
  2799. There are three types of highlight groups:
  2800. - The ones used for specific languages.  For these the name starts with the
  2801.   name of the language.  Many of these don't have any attributes, but are
  2802.   linked to a group of the second type.
  2803. - The ones used for all syntax languages.
  2804. - The ones used for the 'highlight' option.
  2805.                             *hitest.vim*
  2806. You can see all the groups currently active with this command: >
  2807.     :so $VIMRUNTIME/syntax/hitest.vim
  2808. This will open a new window containing all highlight group names, displayed
  2809. in their own color.
  2810.  
  2811.                         *:colo* *:colorscheme* *E185*
  2812. :colo[rscheme] {name}    Load color scheme {name}.  This searches 'runtimepath'
  2813.             for the file "colors/{name}.vim.  The first one that
  2814.             is found is loaded.
  2815.             To see the name of the currently active color scheme: >
  2816.                 :echo colors_name
  2817.  
  2818. :hi[ghlight]        List all the current highlight groups that have
  2819.             attributes set.
  2820.  
  2821. :hi[ghlight] {group-name}
  2822.             List one highlight group.
  2823.  
  2824. :hi[ghlight] clear    Reset all highlighting to the defaults.  Removes all
  2825.             highlighting for groups added by the user!
  2826.             Uses the current value of 'background' to decide which
  2827.             default colors to use.
  2828.  
  2829. :hi[ghlight] clear {group-name}
  2830. :hi[ghlight] {group-name} NONE
  2831.             Disable the highlighting for one highlight group.  It
  2832.             is _not_ set back to the default colors.
  2833.  
  2834. :hi[ghlight] [default] {group-name} {key}={arg} ..
  2835.             Add a highlight group, or change the highlighting for
  2836.             an existing group.
  2837.             See |highlight-args| for the {key}={arg} arguments.
  2838.             See |:highlight-default| for the optional [default]
  2839.             argument.
  2840.  
  2841. Normally a highlight group is added once, in the *.vim file.  This sets
  2842. the default values for the highlighting.  After that, you can use additional
  2843. highlight commands to change the arguments that you want to set to
  2844. non-default values.  The value "NONE" can be used to switch the value off or
  2845. go back to the default value.
  2846.  
  2847. Example.  The syntax.vim file contains this line: >
  2848.    :hi Comment    term=bold ctermfg=Cyan guifg=#80a0ff
  2849.  
  2850. You can change this by giving another ":highlight: command: >
  2851.    :hi Comment    gui=bold
  2852.  
  2853. Note that all settings that are not included remain the same, only the
  2854. specified field is used, and settings are merged with previous ones.  So, the
  2855. result is like this single command has been used: >
  2856.    :hi Comment    term=bold ctermfg=Cyan guifg=#80a0ff gui=bold
  2857. <
  2858.                     *highlight-args* *E416* *E417* *E423*
  2859. There are three types of terminals for highlighting:
  2860. term    a normal terminal (vt100, xterm)
  2861. cterm    a color terminal (MS-DOS console, color-xterm, these have the "Co"
  2862.     termcap entry)
  2863. gui    the GUI
  2864.  
  2865. For each type the highlighting can be given.  This makes it possible to use
  2866. the same syntax file on all terminals, and use the optimal highlighting.
  2867.  
  2868. 1. highlight arguments for normal terminals
  2869.  
  2870. term={attr-list}            *attr-list* *highlight-term* *E418*
  2871.     attr-list is a comma separated list (without spaces) of the
  2872.     following items (in any order):
  2873.         bold
  2874.         underline
  2875.         reverse
  2876.         inverse        same as reverse
  2877.         italic
  2878.         standout
  2879.         NONE        no attributes used (used to reset it)
  2880.  
  2881.     Note that "bold" can be used here and by using a bold font.  They
  2882.     have the same effect.
  2883.  
  2884. start={term-list}                *highlight-start* *E422*
  2885. stop={term-list}                *term-list* *highlight-stop*
  2886.     These lists of terminal codes can be used to get
  2887.     non-standard attributes on a terminal.
  2888.  
  2889.     The escape sequence specified with the "start" argument
  2890.     is written before the characters in the highlighted
  2891.     area.  It can be anything that you want to send to the
  2892.     terminal to highlight this area.  The escape sequence
  2893.     specified with the "stop" argument is written after the
  2894.     highlighted area.  This should undo the "start" argument.
  2895.     Otherwise the screen will look messed up.
  2896.  
  2897.     The {term-list} can have two forms:
  2898.  
  2899.     1. A string with escape sequences.
  2900.        This is any string of characters, except that it can't start with
  2901.        "t_" and blanks are not allowed.  The <> notation is recognized
  2902.        here, so you can use things like "<Esc>" and "<Space>".  Example:
  2903.         start=<Esc>[27h;<Esc>[<Space>r;
  2904.  
  2905.     2. A list of terminal codes.
  2906.        Each terminal code has the form "t_xx", where "xx" is the name of
  2907.        the termcap entry.  The codes have to be separated with commas.
  2908.        White space is not allowed.  Example:
  2909.         start=t_C1,t_BL
  2910.        The terminal codes must exist for this to work.
  2911.  
  2912.  
  2913. 2. highlight arguments for color terminals
  2914.  
  2915. cterm={attr-list}                    *highlight-cterm*
  2916.     See above for the description of {attr-list} |attr-list|.
  2917.     The "cterm" argument is likely to be different from "term", when
  2918.     colors are used.  For example, in a normal terminal comments could
  2919.     be underlined, in a color terminal they can be made Blue.
  2920.     Note: Many terminals (e.g., DOS console) can't mix these attributes
  2921.     with coloring.  Use only one of "cterm=" OR "ctermfg=" OR "ctermbg=".
  2922.  
  2923. ctermfg={color-nr}                *highlight-ctermfg* *E421*
  2924. ctermbg={color-nr}                *highlight-ctermbg*
  2925.     The {color-nr} argument is a color number.  Its range is zero to
  2926.     (not including) the number given by the termcap entry "Co".
  2927.     The actual color with this number depends on the type of terminal
  2928.     and its settings.  Sometimes the color also depends on the settings of
  2929.     "cterm".  For example, on some systems "cterm=bold ctermfg=3" gives
  2930.     another color, on others you just get color 3.
  2931.  
  2932.     For an xterm this depends on your resources, and is a bit
  2933.     unpredictable.  See your xterm documentation for the defaults.  The
  2934.     colors for a color-xterm can be changed from the .Xdefaults file.
  2935.     Unfortunately this means that it's not possible to get the same colors
  2936.     for each user.  See |xterm-color| for info about color xterms.
  2937.  
  2938.     The MSDOS standard colors are fixed (in a console window), so these
  2939.     have been used for the names.  But the meaning of color names in X11
  2940.     are fixed, so these color settings have been used, to make the
  2941.     highlighting settings portable (complicated, isn't it?).  The
  2942.     following names are recognized, with the color number used:
  2943.  
  2944.         NR-16   NR-8    COLOR NAME ~
  2945.                             *cterm-colors*
  2946.         0        0        Black
  2947.         1        4        DarkBlue
  2948.         2       2        DarkGreen
  2949.         3       6        DarkCyan
  2950.         4       1        DarkRed
  2951.         5       5        DarkMagenta
  2952.         6       3        Brown, DarkYellow
  2953.         7       7        LightGray, LightGrey, Gray, Grey
  2954.         8        0*        DarkGray, DarkGrey
  2955.         9        4*        Blue, LightBlue
  2956.         10        2*        Green, LightGreen
  2957.         11        6*        Cyan, LightCyan
  2958.         12        1*        Red, LightRed
  2959.         13        5*        Magenta, LightMagenta
  2960.         14        3*        Yellow, LightYellow
  2961.         15        7*        White
  2962.  
  2963.     The number under "NR-16" is used for 16-color terminals ('t_Co'
  2964.     greater than or equal to 16).  The number under "NR-8" is used for
  2965.     8-color terminals ('t_Co' less than 16).  The '*' indicates that the
  2966.     bold attribute is set for ctermfg.  In many 8-color terminals (e.g.,
  2967.     "linux"), this causes the bright colors to appear.  This doesn't work
  2968.     for background colors!  Without the '*' the bold attribute is removed.
  2969.     If you want to set the bold attribute in a different way, put a
  2970.     "cterm=" argument AFTER the "ctermfg=" or "ctermbg=" argument.  Or use
  2971.     a number instead of a color name.
  2972.  
  2973.     The case of the color names is ignored.
  2974.     Note that for 16 color ansi style terminals (including xterms), the
  2975.     numbers in the NR-8 column is used. Here '*' means 'add 8' so that Blue
  2976.     is 12, DarkGray is 8 etc.
  2977.  
  2978.     Note that for some color terminals these names may result in the wrong
  2979.     colors!
  2980.  
  2981.                             *:hi-normal-cterm*
  2982.     When setting the "ctermfg" or "ctermbg" colors for the Normal group,
  2983.     these will become the colors used for the non-highlighted text.
  2984.     Example: >
  2985.         :highlight Normal ctermfg=grey ctermbg=darkblue
  2986. <    When setting the "ctermbg" color for the Normal group, the
  2987.     'background' option will be adjusted automatically.  This causes the
  2988.     highlight groups that depend on 'background' to change!  This means
  2989.     you should set the colors for Normal first, before setting other
  2990.     colors.
  2991.     When a colorscheme is being used, changing 'background' causes it to
  2992.     be reloaded, which may reset all colors (including Normal).  First
  2993.     delete the "colors_name" variable when you don't want this.
  2994.  
  2995.     When you have set "ctermfg" or "ctermbg" for the Normal group, Vim
  2996.     needs to reset the color when exiting.  This is done with the "op"
  2997.     termcap entry |t_op|.  If this doesn't work correctly, try setting the
  2998.     't_op' option in your .vimrc.
  2999.                             *E419* *E420*
  3000.     When Vim knows the normal foreground and background colors, "fg" and
  3001.     "bg" can be used as color names.  This only works after setting the
  3002.     colors for the Normal group and for the MS-DOS console.  Example, for
  3003.     reverse video: >
  3004.         :highlight Visual ctermfg=bg ctermbg=fg
  3005. <    Note that the colors are used that are valid at the moment this
  3006.     command are given.  If the Normal group colors are changed later, the
  3007.     "fg" and "bg" colors will not be adjusted.
  3008.  
  3009.  
  3010. 3. highlight arguments for the GUI
  3011.  
  3012. gui={attr-list}                        *highlight-gui*
  3013.     These give the attributes to use in the GUI mode.
  3014.     See |attr-list| for a description.
  3015.     Note that "bold" can be used here and by using a bold font.  They
  3016.     have the same effect.
  3017.     Note that the attributes are ignored for the "Normal" group.
  3018.  
  3019. font={font-name}                    *highlight-font*
  3020.     font-name is the name of a font, as it is used on the system Vim
  3021.     runs on.  For X11 this is a complicated name, for example: >
  3022.    font=-misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-1
  3023. <
  3024.     The font-name "NONE" can be used to revert to the default font.
  3025.     When setting the font for the "Normal" group, this becomes the default
  3026.     font (until the 'guifont' option is changed; the last one set is
  3027.     used).
  3028.     The following only works with Motif and Athena, not with other GUIs:
  3029.     When setting the font for the "Menu" group, the menus will be changed.
  3030.     When setting the font for the "Tooltip" group, the tooltips will be
  3031.     changed.
  3032.     All fonts used, except for Menu and Tooltip, should be of the same
  3033.     character size as the default font!  Otherwise redrawing problems will
  3034.     occur.
  3035.  
  3036. guifg={color-name}                    *highlight-guifg*
  3037. guibg={color-name}                    *highlight-guibg*
  3038.     These give the foreground (guifg) and background (guibg) color to
  3039.     use in the GUI.  There are a few special names:
  3040.         NONE        no color (transparent)
  3041.         bg        use normal background color
  3042.         background    use normal background color
  3043.         fg        use normal foreground color
  3044.         foreground    use normal foreground color
  3045.     To use a color name with an embedded space or other special character,
  3046.     put it in single quotes.  The single quote cannot be used then.
  3047.     Example: >
  3048.         :hi comment guifg='salmon pink'
  3049. <
  3050.                             *gui-colors* *E242*
  3051.     Suggested color names (these are available on most systems):
  3052.         Red        LightRed    DarkRed
  3053.         Green    LightGreen    DarkGreen    SeaGreen
  3054.         Blue    LightBlue    DarkBlue    SlateBlue
  3055.         Cyan    LightCyan    DarkCyan
  3056.         Magenta    LightMagenta    DarkMagenta
  3057.         Yellow    LightYellow    Brown        DarkYellow
  3058.         Gray    LightGray    DarkGray
  3059.         Black    White
  3060.         Orange    Purple        Violet
  3061.  
  3062.     In the Win32 GUI version, additional system colors are available.  See
  3063.     |win32-colors|.
  3064.  
  3065.     You can also specify a color by its Red, Green and Blue values.
  3066.     The format is "#rrggbb", where
  3067.         "rr"    is the Red value
  3068.         "bb"    is the Blue value
  3069.         "gg"    is the Green value
  3070.     All values are hexadecimal, range from "00" to "ff".  Examples: >
  3071.   :highlight Comment guifg=#11f0c3 guibg=#ff00ff
  3072. <
  3073.                     *highlight-groups* *highlight-default*
  3074. These are the default highlighting groups.  These groups are used by the
  3075. 'highlight' option default.  Note that the highlighting depends on the value
  3076. of 'background'.  You can see the current settings with the ":highlight"
  3077. command.
  3078.                             *hl-Cursor*
  3079. Cursor        the character under the cursor
  3080.                             *hl-CursorIM*
  3081. CursorIM    like Cursor, but used when in IME mode |CursorIM|
  3082.                             *hl-Directory*
  3083. Directory    directory names (and other special names in listings)
  3084.                             *hl-DiffAdd*
  3085. DiffAdd        diff mode: Added line |diff.txt|
  3086.                             *hl-DiffChange*
  3087. DiffChange    diff mode: Changed line |diff.txt|
  3088.                             *hl-DiffDelete*
  3089. DiffDelete    diff mode: Deleted line |diff.txt|
  3090.                             *hl-DiffText*
  3091. DiffText    diff mode: Changed text within a changed line |diff.txt|
  3092.                             *hl-ErrorMsg*
  3093. ErrorMsg    error messages on the command line
  3094.                             *hl-VertSplit*
  3095. VertSplit    the column separating vertically split windows
  3096.                             *hl-Folded*
  3097. Folded        line used for closed folds
  3098.                             *hl-FoldColumn*
  3099. FoldColumn    'foldcolumn'
  3100.                             *hl-IncSearch*
  3101. IncSearch    'incsearch' highlighting; also used for the text replaced with
  3102.         ":s///c"
  3103.                             *hl-LineNr*
  3104. LineNr        line number for ":number" and ":#" commands, and when 'number'
  3105.         option is set.
  3106.                             *hl-ModeMsg*
  3107. ModeMsg        'showmode' message (e.g., "-- INSERT --")
  3108.                             *hl-MoreMsg*
  3109. MoreMsg        |more-prompt|
  3110.                             *hl-NonText*
  3111. NonText        '~' and '@' at the end of the window, characters from
  3112.         'showbreak' and other characters that do not really exist in
  3113.         the text (e.g., ">" displayed when a double-wide character
  3114.         doesn't fit at the end of the line).
  3115.                             *hl-Normal*
  3116. Normal        normal text
  3117.                             *hl-Question*
  3118. Question    |hit-enter| prompt and yes/no questions
  3119.                             *hl-Search*
  3120. Search        last search pattern highlighting (see 'hlsearch')
  3121.                             *hl-SpecialKey*
  3122. SpecialKey    Meta and special keys listed with ":map", also for text used
  3123.         to show unprintable characters in the text, 'listchars'.
  3124.         Generally: text that is displayed differently from what it
  3125.         really is.
  3126.                             *hl-StatusLine*
  3127. StatusLine    status line of current window
  3128.                             *hl-StatusLineNC*
  3129. StatusLineNC    status lines of not-current windows
  3130.         Note: if this is equal to "StatusLine" Vim will use "^^^" in
  3131.         the status line of the current window.
  3132.                             *hl-Title*
  3133. Title        titles for output from ":set all", ":autocmd" etc.
  3134.                             *hl-Visual*
  3135. Visual        Visual mode selection
  3136.                             *hl-VisualNOS*
  3137. VisualNOS    Visual mode selection when vim is "Not Owning the Selection".
  3138.         Only X11 Gui's |gui-x11| and |xterm-clipboard| supports this.
  3139.                             *hl-WarningMsg*
  3140. WarningMsg    warning messages
  3141.                             *hl-WildMenu*
  3142. WildMenu    current match in 'wildmenu' completion
  3143.  
  3144.                         *hl-User1* *hl-User1..9*
  3145. The 'statusline' syntax allows the use of 9 different highlights in the
  3146. statusline and ruler (via 'rulerformat'). The names are User1 to User9.
  3147.  
  3148. For the GUI you can use these groups to set the colors for the menu,
  3149. scrollbars and tooltips.  They don't have defaults.  This doesn't work for the
  3150. Win32 GUI.  Only three highlight arguments have any effect here: font, guibg,
  3151. and guifg.
  3152.  
  3153.                             *hl-Menu*
  3154. Menu        Current font, background and foreground colors of the menus.
  3155.         Also used for the toolbar.
  3156.         Applicable highlight arguments: font, guibg, guifg.
  3157.  
  3158.         NOTE: For Motif and Athena the font argument actually
  3159.         specifies a fontset at all times, no matter if 'guifontset' is
  3160.         empty, and as such it is tied to the current |:language| when
  3161.         set.
  3162.  
  3163.                             *hl-Scrollbar*
  3164. Scrollbar    Current background and foreground of the main window's
  3165.         scrollbars.
  3166.         Applicable highlight arguments: guibg, guifg.
  3167.  
  3168.                             *hl-Tooltip*
  3169. Tooltip        Current font, background and foreground of the tooltips.
  3170.         Applicable highlight arguments: font, guibg, guifg.
  3171.  
  3172.         NOTE: For Motif and Athena the font argument actually
  3173.         specifies a fontset at all times, no matter if 'guifontset' is
  3174.         empty, and as such it is tied to the current |:language| when
  3175.         set.
  3176.  
  3177. ==============================================================================
  3178. 13. Linking groups        *:hi-link* *:highlight-link* *E412* *E413*
  3179.  
  3180. When you want to use the same highlighting for several syntax groups, you
  3181. can do this more easily by linking the groups into one common highlight
  3182. group, and give the color attributes only for that group.
  3183.  
  3184. To set a link:
  3185.  
  3186.     :hi[ghlight][!] [default] link {from-group} {to-group}
  3187.  
  3188. To remove a link:
  3189.  
  3190.     :hi[ghlight][!] [default] link {from-group} NONE
  3191.  
  3192. Notes:                            *E414*
  3193. - If the {from-group} and/or {to-group} doesn't exist, it is created.  You
  3194.   don't get an error message for a non-existing group.
  3195. - As soon as you use a ":highlight" command for a linked group, the link is
  3196.   removed.
  3197. - If there are already highlight settings for the {from-group}, the link is
  3198.   not made, unless the '!' is given.  For a ":highlight link" command in a
  3199.   sourced file, you don't get an error message.  This can be used to skip
  3200.   links for groups that already have settings.
  3201.  
  3202.                     *:hi-default* *:highlight-default*
  3203. The [default] argument is used for setting the default highlighting for a
  3204. group.  If highlighting has already been specified for the group the command
  3205. will be ignored.  Also when there is an existing link.
  3206.  
  3207. Using [default] is especially useful to overrule the highlighting of a
  3208. specific syntax file.  For example, the C syntax file contains: >
  3209.     :highlight default link cComment Comment
  3210. If you like Question highlighting for C comments, put this in your vimrc file: >
  3211.     :highlight link cComment Question
  3212. Without the "default" in the C syntax file, the highlighting would be
  3213. overruled when the syntax file is loaded.
  3214.  
  3215. ==============================================================================
  3216. 14. Cleaning up                        *:syn-clear* *E391*
  3217.  
  3218. If you want to clear the syntax stuff for the current buffer, you can use this
  3219. command: >
  3220.   :syntax clear
  3221.  
  3222. This command should be used when you want to switch off syntax highlighting,
  3223. or when you want to switch to using another syntax.  It's normally not needed
  3224. in a syntax file itself, because syntax is cleared by the autocommands that
  3225. load the syntax file.
  3226. The command also deletes the "b:current_syntax" variable, since no syntax is
  3227. loaded after this command.
  3228.  
  3229. If you want to disable syntax highlighting for all buffers, you need to remove
  3230. the autocommands that load the syntax files: >
  3231.   :syntax off
  3232.  
  3233. What this command actually does, is executing the command >
  3234.   :source $VIMRUNTIME/syntax/nosyntax.vim
  3235. See the "nosyntax.vim" file for details.  Note that for this to work
  3236. $VIMRUNTIME must be valid.  See |$VIMRUNTIME|.
  3237.  
  3238. To clean up specific syntax groups for the current buffer: >
  3239.   :syntax clear {group-name} ..
  3240. This removes all patterns and keywords for {group-name}.
  3241.  
  3242. To clean up specific syntax group lists for the current buffer: >
  3243.   :syntax clear @{grouplist-name} ..
  3244. This sets {grouplist-name}'s contents to an empty list.
  3245.  
  3246.                         *:syntax-reset* *:syn-reset*
  3247. If you have changed the colors and messed them up, use this command to get the
  3248. defaults back: >
  3249.  
  3250.   :syntax reset
  3251.  
  3252. This doesn't change the colors for the 'highlight' option.
  3253.  
  3254. Note that the syntax colors that you set in your vimrc file will also be reset
  3255. back to their Vim default.
  3256. Note that if you are using a color scheme, the colors defined by the color
  3257. scheme for syntax highlighting will be lost.
  3258.  
  3259. What this actually does is: >
  3260.  
  3261.     let g:syntax_cmd = "reset"
  3262.     runtime! syntax/syncolor.vim
  3263.  
  3264. Note that this uses the 'runtimepath' option.
  3265.  
  3266.                             *syncolor*
  3267. If you want to use different colors for syntax highlighting, you can add a Vim
  3268. script file to set these colors.  Put this file in a directory in
  3269. 'runtimepath' which comes after $VIMRUNTIME, so that your settings overrule
  3270. the default colors.  This way these colors will be used after the ":syntax
  3271. reset" command.
  3272.  
  3273. For Unix you can use the file ~/.vim/after/syntax/syncolor.vim.  Example: >
  3274.  
  3275.     if &background == "light"
  3276.       highlight comment ctermfg=darkgreen guifg=darkgreen
  3277.     else
  3278.       highlight comment ctermfg=green guifg=green
  3279.     endif
  3280.  
  3281. Note that when a color scheme is used, there might be some confusion whether
  3282. your defined colors are to be used or the colors from the scheme.  This
  3283. depends on the color scheme file.  See |:colorscheme|.
  3284.  
  3285.                             *syntax_cmd*
  3286. The "syntax_cmd" variable is set to one of these values when the
  3287. syntax/syncolor.vim files are loaded:
  3288.    "on"        ":syntax on" command.  Highlight colors are overruled but
  3289.         links are kept
  3290.    "enable"    ":syntax enable" command.  Only define colors for groups that
  3291.         don't have highlighting yet.  Use ":syntax default".
  3292.    "reset"    ":syntax reset" command or loading a color scheme.  Define all
  3293.         the colors.
  3294.    "skip"    Dont' define colors.  Used to skip the default settings when a
  3295.         syncolor.vim file earlier in 'runtimepath' has already set
  3296.         them.
  3297.  
  3298. ==============================================================================
  3299. 15. Highlighting tags                    *tag-highlight*
  3300.  
  3301. If you want to highlight all the tags in your file, you can use the following
  3302. mappings.
  3303.  
  3304.     <F11>    -- Generate tags.vim file, and highlight tags.
  3305.     <F12>    -- Just highlight tags based on existing tags.vim file.
  3306. >
  3307.   :map <F11>  :sp tags<CR>:%s/^\([^    :]*:\)\=\([^    ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12>
  3308.   :map <F12>  :so tags.vim<CR>
  3309.  
  3310. WARNING: The longer the tags file, the slower this will be, and the more
  3311. memory Vim will consume.
  3312.  
  3313. Only highlighting typedefs, unions and structs can be done too.  For this you
  3314. must use Exuberant ctags (found at http://ctags.sf.net).
  3315.  
  3316. Put these lines in your Makefile:
  3317.  
  3318. # Make a highlight file for types.  Requires Exuberant ctags and awk
  3319. types: types.vim
  3320. types.vim: *.[ch]
  3321.     ctags -i=gstuS -o- *.[ch] |\
  3322.         awk 'BEGIN{printf("syntax keyword Type\t")}\
  3323.             {printf("%s ", $$1)}END{print ""}' > $@
  3324.  
  3325. And put these lines in your .vimrc: >
  3326.  
  3327.    " load the types.vim highlighting file, if it exists
  3328.    autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim'
  3329.    autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)
  3330.    autocmd BufRead,BufNewFile *.[ch]   exe 'so ' . fname
  3331.    autocmd BufRead,BufNewFile *.[ch] endif
  3332.  
  3333. ==============================================================================
  3334. 16. Color xterms                *xterm-color* *color-xterm*
  3335.  
  3336. Most color xterms have only eight colors.  They should work with these
  3337. lines in your .vimrc: >
  3338.    :if has("terminfo")
  3339.    :  set t_Co=8
  3340.    :  set t_Sf=<Esc>[3%p1%dm
  3341.    :  set t_Sb=<Esc>[4%p1%dm
  3342.    :else
  3343.    :  set t_Co=8
  3344.    :  set t_Sf=<Esc>[3%dm
  3345.    :  set t_Sb=<Esc>[4%dm
  3346.    :endif
  3347. <    [<Esc> is a real escape, type CTRL-V <Esc>]
  3348.  
  3349. You might want to put these lines in an ":if" that checks the name of your
  3350. terminal, for example: >
  3351.    :if &term =~ "xterm"
  3352. <  put above lines here >
  3353.    :endif
  3354.  
  3355. Note: Do these settings BEFORE doing ":syntax on".  Otherwise the colors may
  3356. be wrong.
  3357.                             *xiterm* *rxvt*
  3358. The above settings have been mentioned to work for xiterm and rxvt too.
  3359.  
  3360.                             *colortest.vim*
  3361. To test your color setup, a file has been included in the Vim distribution.
  3362. To use it, execute these commands: >
  3363.    :e $VIMRUNTIME/syntax/colortest.vim
  3364.    :so %
  3365.  
  3366. Some versions of xterm (and other terminals, like the linux console) can
  3367. output lighter foreground colors, even though the number of colors is defined
  3368. at 8.  Therefore Vim sets the "cterm=bold" attribute for light foreground
  3369. colors, when 't_Co' is 8.
  3370.  
  3371.                             *xfree-xterm*
  3372. To get 16 colors or more, get the newest xterm version (which should be
  3373. included with Xfree86 3.3 and later).  You can also find the latest version
  3374. at: >
  3375.     http://www.clark.net/pub/dickey/xterm
  3376. Here is a good way to configure it.  This uses 88 colors and enables the
  3377. termcap-query feature, which allows Vim to ask the xterm how many colors it
  3378. supports. >
  3379.     ./configure --disable-bold-color --enable-88-color --enable-tcap-query
  3380. If you only get 8 colors, check the xterm compilation settings.
  3381. (Also see |UTF8-xterm| for using this xterm with UTF-8 character encoding).
  3382.  
  3383. This xterm should work with these lines in your .vimrc: >
  3384.    :if has("terminfo")
  3385.    :  set t_Co=16
  3386.    :  set t_AB=<Esc>[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
  3387.    :  set t_AF=<Esc>[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
  3388.    :else
  3389.    :  set t_Co=16
  3390.    :  set t_Sf=<Esc>[3%dm
  3391.    :  set t_Sb=<Esc>[4%dm
  3392.    :endif
  3393. <    [<Esc> is a real escape, type CTRL-V <Esc>]
  3394.  
  3395. Without |+terminfo|, Vim will recognize these settings, and automatically
  3396. translate cterm colors of 8 and above to "<Esc>[9%dm" and "<Esc>[10%dm".
  3397. Colors above 16 are also translated automatically.
  3398.  
  3399. Or just set the TERM environment variable to "xterm-16color" and try if that
  3400. works.
  3401.  
  3402. You probably want to use these X resources (in your ~/.Xdefaults file):
  3403.     XTerm*color0:            #000000
  3404.     XTerm*color1:            #c00000
  3405.     XTerm*color2:            #008000
  3406.     XTerm*color3:            #808000
  3407.     XTerm*color4:            #0000c0
  3408.     XTerm*color5:            #c000c0
  3409.     XTerm*color6:            #008080
  3410.     XTerm*color7:            #c0c0c0
  3411.     XTerm*color8:            #808080
  3412.     XTerm*color9:            #ff6060
  3413.     XTerm*color10:            #00ff00
  3414.     XTerm*color11:            #ffff00
  3415.     XTerm*color12:            #8080ff
  3416.     XTerm*color13:            #ff40ff
  3417.     XTerm*color14:            #00ffff
  3418.     XTerm*color15:            #ffffff
  3419.     Xterm*cursorColor:        Black
  3420.  
  3421. [Note: The cursorColor is required to work around a bug, which changes the
  3422. cursor color to the color of the last drawn text.  This has been fixed by a
  3423. newer version of xterm, but not everybody is it using yet.]
  3424.  
  3425. To get these right away, reload the .Xdefaults file to the X Option database
  3426. Manager (you only need to do this when you just changed the .Xdefaults file): >
  3427.   xrdb -merge ~/.Xdefaults
  3428. <
  3429.                             *xterm-blink*
  3430. To make the cursor blink in an xterm, see tools/blink.c.  Or use Thomas
  3431. Dickey's xterm above patchlevel 107 (see above for where to get it), with
  3432. these resources:
  3433.     XTerm*cursorBlink:    on
  3434.     XTerm*cursorOnTime:    400
  3435.     XTerm*cursorOffTime:    250
  3436.     XTerm*cursorColor:    White
  3437.  
  3438.                             *hpterm-color*
  3439. These settings work (more or less) for a hpterm, which only supports 8
  3440. foreground colors: >
  3441.    :if has("terminfo")
  3442.    :  set t_Co=8
  3443.    :  set t_Sf=<Esc>[&v%p1%dS
  3444.    :  set t_Sb=<Esc>[&v7S
  3445.    :else
  3446.    :  set t_Co=8
  3447.    :  set t_Sf=<Esc>[&v%dS
  3448.    :  set t_Sb=<Esc>[&v7S
  3449.    :endif
  3450. <    [<Esc> is a real escape, type CTRL-V <Esc>]
  3451.  
  3452.                         *Eterm* *enlightened-terminal*
  3453. These settings have been reported to work for the Enlightened terminal
  3454. emulator, or Eterm.  They might work for all xterm-like terminals that use the
  3455. bold attribute to get bright colors.  Add an ":if" like above when needed. >
  3456.        :set t_Co=16
  3457.        :set t_AF=^[[%?%p1%{8}%<%t3%p1%d%e%p1%{22}%+%d;1%;m
  3458.        :set t_AB=^[[%?%p1%{8}%<%t4%p1%d%e%p1%{32}%+%d;1%;m
  3459. <
  3460.                         *TTpro-telnet*
  3461. These settings should work for TTpro telnet.  Tera Term Pro is a freeware /
  3462. open-source program for MS-Windows. >
  3463.     set t_Co=16
  3464.     set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{32}%+5;%;%dm
  3465.     set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{22}%+1;%;%dm
  3466. Also make sure TTpro's Setup / Window / Full Color is enabled, and make sure
  3467. that Setup / Font / Enable Bold is NOT enabled.
  3468. (info provided by John Love-Jensen <eljay@Adobe.COM>)
  3469.  
  3470.  vim:tw=78:sw=4:ts=8:ft=help:norl:
  3471.